Ejemplo n.º 1
0
 def kick(self, buddy):
     reply = self._client.send_command(
         ts3.Command('clientkick',
                     clid=buddy.clid,
                     reasonid=5,
                     reasonmsg='No reason given'))
     logger.info("Kicked %s (%s)", buddy.nickname, buddy.clid)
Ejemplo n.º 2
0
 def _parse_notifycliententerview_reply(self, message):
     reply = self._client.send_command(
         ts3.Command('clientvariable', clid=message.args['clid']))
     item = self._create_menu_item(message, None)
     item.channel = self._channel_map[int(message.args['ctid'])]
     self._buddies.append(item)
     self._buddy_map[item.clid] = item
     self._update_item_from_message(item, message)
     c = self._plugin.new_buddy(item)
Ejemplo n.º 3
0
    def get_buddies(self):
        if self._buddies == None:
            self._buddy_map = {}
            # Get the basic details
            reply = self._client.send_command(
                ts3.Command('clientlist -away -voice -uid'))
            self._parse_clientlist_reply(reply)

        return self._buddies
Ejemplo n.º 4
0
    def set_current_channel(self, channel_item):
        try:
            reply = self._client.send_command(
                ts3.Command('clientmove',
                            clid=self._clid,
                            cid=channel_item.cid))

        except ts3.TS3CommandException as e:
            logger.debug("Error when changing channel", exc_info=e)
Ejemplo n.º 5
0
    def get_current_channel(self):
        if self._current_channel is None:
            if self._channels is None:
                self.get_channels()

            reply = self._client.send_command(
                ts3.Command('channelconnectinfo'))
            if 'path' in reply.args:
                channel_path = reply.args['path']
                for c in self._channels:
                    if c.path == channel_path:
                        self._current_channel = c

        return self._current_channel
Ejemplo n.º 6
0
    def get_channels(self):
        if self._channels is None:
            self._channel_map = {}
            self._channels = []

            reply = self._client.send_command(ts3.Command(
                'serverconnectionhandlerlist'))

            for r in reply.responses if isinstance(reply, ts3.message.MultipartMessage) else [reply]:
                s = int(r.args['schandlerid'])
                reply = self._client.send_command(ts3.Command(
                    'use', schandlerid=s))

                # Get the server IP and port
                try:
                    reply = self._client.send_command(ts3.Command(
                        'serverconnectinfo'))
                    ip = reply.args['ip']
                    port = int(reply.args['port'])

                    # A menu item for the server                
                    item = Teamspeak3ServerMenuItem(s, "%s:%d" % (ip, port), self)
                    self._channels.append(item)

                    reply = self._client.send_command(
                        ts3.Command(
                            'channellist'
                        ))
                    self._parse_channellist_reply(reply, s)
                except ts3.TS3CommandException as e:
                    logger.debug("Error when getting channel list", exc_info=e)

            # Switch back to the selected server connection
            reply = self._client.send_command(ts3.Command(
                'use', schandlerid=self._client.schandlerid))

        return self._channels
Ejemplo n.º 7
0
#  Copyright (C) 2012 Brett Smith <*****@*****.**>
#
#  This program is free software: you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation, either version 3 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program.  If not, see <http://www.gnu.org/licenses/>.

import logging
import ts3
import gnome15.g15logging as g15logging

if __name__ == "__main__":
    logger = g15logging.get_root_logger()
    logger.setLevel(logging.INFO)

    t = ts3.TS3()
    t.start()

    logger.info("schandlerid : %d", t.schandlerid)

    logger.info("channel: %s",
                t.send_command(ts3.Command('channelconnectinfo')).args['path'])
Ejemplo n.º 8
0
#  Copyright (C) 2012 Brett Smith <*****@*****.**>
#
#  This program is free software: you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation, either version 3 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program.  If not, see <http://www.gnu.org/licenses/>.

import ts3
from gnome15 import g15logging
import logging
 
if __name__ == "__main__":
    logger = g15logging.get_root_logger()
    logger.setLevel(logging.INFO)
    
    t = ts3.TS3()
    t.start()
    
    logger.info("schandlerid : %d", t.schandlerid)
    
    
    logger.info("channel: %s", t.send_command(ts3.Command('channelconnectinfo')).args['path'])
    
Ejemplo n.º 9
0
    def _get_server_uid(self):
        reply = self._client.send_command(ts3.Command(
            'servervariable', virtualserver_unique_identifier=None

        ))
        self._server_uid = reply.args['virtualserver_unique_identifier']
Ejemplo n.º 10
0
 def _get_clid(self):
     reply = self._client.send_command(ts3.Command(
         'whoami', virtualserver_unique_identifier=None
     ))
     self._clid = int(reply.args['clid'])
     logger.info("Your CLID is %d", self._clid)
Ejemplo n.º 11
0
 def set_audio_output(self, mute):
     reply = self._client.send_command(ts3.Command(
         'clientupdate',
         client_output_muted=1 if mute else 0
     ))
Ejemplo n.º 12
0
 def online(self):
     reply = self._client.send_command(ts3.Command(
         'clientupdate',
         client_away=0
     ))
Ejemplo n.º 13
0
 def away(self):
     reply = self._client.send_command(ts3.Command(
         'clientupdate',
         client_away=1
     ))
Ejemplo n.º 14
0
 def ban(self, buddy):
     if buddy.uid is None:
         raise Exception("UID is not known")
     reply = self._client.send_command(ts3.Command(
         'banadd', banreason='No reason given', uid=buddy.uid))
     logger.info("Banned %s (%s)", buddy.nickname, buddy.uid)