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)
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)
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
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)
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
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
# 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'])
# 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'])
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']
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)
def set_audio_output(self, mute): reply = self._client.send_command(ts3.Command( 'clientupdate', client_output_muted=1 if mute else 0 ))
def online(self): reply = self._client.send_command(ts3.Command( 'clientupdate', client_away=0 ))
def away(self): reply = self._client.send_command(ts3.Command( 'clientupdate', client_away=1 ))
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)