def onUserLoggingMessageEvent(self, logMessage, logLevel, logChannel, schid, logTime, completeLogString): if logLevel != ts3defines.LogLevel.LogLevel_DEBUG: return if schid != ts3lib.getCurrentServerConnectionHandlerID(): return if logChannel != "VolumeLeveler": return clid, level = parseMessage(logMessage) if not clid in self.clients: return # date = parseTime(logTime) if self.clients[clid] > self.maxviolations: self.clients[clid] = 0 client = self.ts3host.getUser(schid, clid) if not client.server.me.getChannelGroupId() in [self.tabs[schid]["channelModGroup"], client.server.defaultChannelAdminGroup]: client.mute() return (err, country) = ts3lib.getClientVariable(schid, clid, ts3defines.ClientPropertiesRare.CLIENT_COUNTRY) msg = "[color=red]You exceeded the volume limit {violations} times, your talk power has been revoked!" if country in ["DE", "AT", "CH"]: msg = "[color=red]Du hast {violations} mal das Lautstaerkelimit von {limit} ueberschritten, deine Talk Power wurde entzogen!" tp = client.channel.neededTalkPower if not tp or tp < 1 or tp == "-1": ts3lib.requestSetClientChannelGroup(schid, [self.tabs[schid]["channelBanGroup"]], [client.channel.channelID], [client.databaseID]) err = ts3lib.requestClientSetIsTalker(schid, clid, False) if err != ts3defines.ERROR_ok: return client.sendTextMsg(msg.replace("{violations}",str(self.maxviolations)).replace("{limit}",str(self.maxlevel))) return if level > self.maxlevel: self.clients[clid] += 1 print(clid, level, self.clients[clid])
def onClientMoveEvent(self, schid, clientID, oldChannelID, newChannelID, visibility, moveMessage): if self.mychan == 0: return (err, suid) = ts3lib.getServerVariable( schid, ts3defines.VirtualServerProperties.VIRTUALSERVER_UNIQUE_IDENTIFIER) if suid != self.suid: return (err, ownID) = ts3lib.getClientID(schid) if clientID == ownID: return if clientID in self.waiting and (newChannelID == 0 or newChannelID == self.mychan): ts3lib.printMessageToCurrentTab( "{} > Removing {} from self.waiting".format( self.name, clientID)) ts3lib.requestSetClientChannelGroup(schid, [10], [self.mychan], [self.waiting[clientID]]) del self.waiting[clientID] return if newChannelID == 0: return (err, sgroups) = ts3lib.getClientVariableAsString( schid, clientID, ts3defines.ClientPropertiesRare.CLIENT_SERVERGROUPS) # (err2, errmsg) = ts3lib.getErrorMessage(err) if oldChannelID != 0: return if "10" in sgroups.split(','): (err, dbid) = ts3lib.getClientVariable( schid, clientID, ts3defines.ClientPropertiesRare.CLIENT_DATABASE_ID) self.waiting[clientID] = dbid ts3lib.printMessageToCurrentTab( "{} > #{} Found new guest {} ({}) giving him channel mod until he's here ;)" .format(self.name, schid, clientURL(schid, clientID), dbid)) ts3lib.requestSetClientChannelGroup(schid, [14], [self.mychan], [dbid]) return
def onClientMoveEvent(self, schid, clid, oldChannelID, newChannelID, visibility, moveMessage): (err, ownID) = ts3lib.getClientID(schid) if clid == ownID: return #(err, clids) = ts3lib.getChannelClientList(schid, newChannelID) (err, ownCID) = ts3lib.getChannelOfClient(schid, ownID) if newChannelID == 0: if clid in self.clients: del self.clients[clid] if ownCID != newChannelID: return (err, owncgid) = ts3lib.getClientVariable( schid, ownID, ts3defines.ClientPropertiesRare.CLIENT_CHANNEL_GROUP_ID) if owncgid in self.modcgids: return (err, cgid) = ts3lib.getClientVariable( schid, clid, ts3defines.ClientPropertiesRare.CLIENT_CHANNEL_GROUP_ID) (err, dcgid) = ts3lib.getServerVariable( schid, ts3defines.VirtualServerPropertiesRare. VIRTUALSERVER_DEFAULT_CHANNEL_GROUP) if cgid != dcgid: return if clid in self.clients: violations = self.clients[clid] if len(violations) > self.maxviolations: if len(violations) > self.maxviolations + 3: del self.clients[clid][0] if violations[-1] < violations[-3] + 3: (err, dbid) = ts3lib.getClientVariable( schid, clid, ts3defines.ClientPropertiesRare.CLIENT_DATABASE_ID) ts3lib.requestSetClientChannelGroup( schid, [self.bancgid], [ownCID], [dbid]) return self.clients[clid].append(time()) else: self.clients[clid] = []
def onUpdateChannelEditedEvent(self, schid, channelID, invokerID, invokerName, invokerUniqueIdentifier): (err, suid) = ts3lib.getServerVariable(schid, ts3defines.VirtualServerProperties.VIRTUALSERVER_UNIQUE_IDENTIFIER) if suid != self.suid: return (err, ownID) = ts3lib.getClientID(schid) if invokerID == ownID: (err, self.settings["maxclients"]) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS) (err, self.settings["tp"]) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelPropertiesRare.CHANNEL_NEEDED_TALK_POWER) (err, ownChannel) = ts3lib.getChannelOfClient(schid, ownID) if channelID != ownChannel: return (err, invokerChannel) = ts3lib.getChannelOfClient(schid, invokerID) if invokerChannel == channelID: return _needed = False (err, ntp) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelPropertiesRare.CHANNEL_NEEDED_TALK_POWER) if ntp != self.settings["tp"]: _needed = True ts3lib.setChannelVariableAsInt(schid, channelID, ts3defines.ChannelPropertiesRare.CHANNEL_NEEDED_TALK_POWER, self.settings["tp"]) (err, cmc) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS) ts3lib.setChannelVariableAsInt(schid, channelID, ts3defines.ChannelPropertiesRare.CHANNEL_FLAG_MAXCLIENTS_UNLIMITED, 0) if cmc != self.settings["maxclients"]: _needed = True ts3lib.setChannelVariableAsInt(schid, channelID, ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS, self.settings["maxclients"]) if _needed: ts3lib.flushChannelUpdates(schid, channelID) self.violations[invokerUniqueIdentifier] += 1 if self.violations[invokerUniqueIdentifier] > 2: (err, dbid) = ts3lib.getClientVariable(schid, ts3defines.ClientPropertiesRare.CLIENT_DATABASE_ID) ts3lib.requestSetClientChannelGroup(schid, [9], [channelID], [dbid]) del self.violations[invokerUniqueIdentifier]
def on_btn_set_clicked(self): try: ts3lib.requestSetClientChannelGroup(self.schid, [self.spn_id.value], [self.channel], [self.dbid]) except: from traceback import format_exc ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "pyTSon", 0)
def commandChannelBanMe(self, schid, targetMode, toID, fromID, params=""): (error, ownID) = ts3lib.getClientID(schid) if self.cfg.getboolean('general', 'customprefix'): prefix = self.cfg.get('general', 'prefix') else: prefix = self.clientURL(schid, ownID) (error, nickname) = ts3lib.getClientVariableAsString(schid, fromID, ts3defines.ClientProperties.CLIENT_NICKNAME) (error, dbid) = ts3lib.getClientVariableAsInt(schid, fromID, ts3defines.ClientPropertiesRare.CLIENT_DATABASE_ID) (error, chan) = ts3lib.getChannelOfClient(schid, ownID) if params == "": params = "Command %scbanme used by %s" % (prefix, nickname) ts3lib.requestSetClientChannelGroup(schid, [12], [chan], [dbid]) ts3lib.requestClientKickFromChannel(schid, fromID, params)
def onSelectedChannelGroupChangedEvent(self, item): try: if item.checkState() == Qt.Checked: items = self.channelGroups.count for i in range(0,items): litem = self.channelGroups.item(i); if litem != item: litem.setCheckState(Qt.Unchecked) #ts3lib.printMessageToCurrentTab("channel: {0} | group: {1} | dbid: {2}".format(self.channel,item.data(Qt.UserRole),self.dbid)) ts3lib.requestSetClientChannelGroup(self.schid, [item.data(Qt.UserRole)], [self.channel], [self.dbid]) except: from traceback import format_exc;ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "pyTSon", 0)
def onClientMoveEvent(self, schid, clientID, oldChannelID, newChannelID, visibility, moveMessage): if not self.enabled: return if self.schid != schid: return if not self.mychan: return (err, suid) = ts3lib.getServerVariable( schid, ts3defines.VirtualServerProperties.VIRTUALSERVER_UNIQUE_IDENTIFIER) if suid != self.suid: return (err, ownID) = ts3lib.getClientID(schid) if clientID == ownID: return if clientID in self.waiting and (newChannelID == 0 or newChannelID == self.mychan): # if newChannelID == self.mychan: # (err, dbid) = ts3lib.getClientVariable(schid, clientID, ts3defines.ClientPropertiesRare.CLIENT_DATABASE_ID) ts3lib.printMessage( schid, "{}: [color=orange]Removing channel mod from {}".format( self.name, self.waiting[clientID] if newChannelID == 0 else clientURL(schid, clientID)), ts3defines.PluginMessageTarget.PLUGIN_MESSAGE_TARGET_SERVER) ts3lib.requestSetClientChannelGroup(schid, [self.sgid_guest], [self.mychan], [self.waiting[clientID]]) del self.waiting[clientID] return if newChannelID == 0 or oldChannelID != 0: return (err, sgids) = ts3lib.getClientVariableAsString( schid, clientID, ts3defines.ClientPropertiesRare.CLIENT_SERVERGROUPS) if not self.sgid_guest in intList(sgids): return # TODO Any way to get the cgid in another channel? (err, uid) = ts3lib.getClientVariable( schid, clientID, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER) if getContactStatus(uid) == ContactStatus.BLOCKED: ts3lib.printMessage( schid, "{}: [color=red]Not allowing blocked user {} in your channel.". format(self.name, clientURL(schid, clientID)), ts3defines.PluginMessageTarget.PLUGIN_MESSAGE_TARGET_SERVER) return (err, dbid) = ts3lib.getClientVariable( schid, clientID, ts3defines.ClientPropertiesRare.CLIENT_DATABASE_ID) self.waiting[clientID] = dbid ts3lib.printMessage( schid, "{}: [color=green]Found new guest {} giving him channel mod until he's here ;)" .format(self.name, clientURL(schid, clientID)), ts3defines.PluginMessageTarget.PLUGIN_MESSAGE_TARGET_SERVER) ts3lib.requestSetClientChannelGroup(schid, [self.cgid_mod], [self.mychan], [dbid])
def setClientChannelGroup(self, schid, status, cid, chid): (error, suid) = ts3.getServerVariableAsString(schid, ts3defines.VirtualServerProperties.VIRTUALSERVER_UNIQUE_IDENTIFIER) (error, curr_channelgroup) = ts3.getClientVariableAsString(schid, cid, ts3defines.ClientPropertiesRare.CLIENT_CHANNEL_GROUP_ID) db = self.db.exec_("SELECT db_f_channelgroup, db_b_channelgroup FROM server WHERE db_suid='"+str(suid)+"' LIMIT 1") if not self.db.lastError().isValid(): if db.next(): if status == 1 and (db.value("db_b_channelgroup") == "" or db.value("db_b_channelgroup") == int(curr_channelgroup)): return if status == 0 and (db.value("db_f_channelgroup") == "" or db.value("db_f_channelgroup") == int(curr_channelgroup)): return (error, cdbid) = ts3.getClientVariableAsUInt64(schid, cid, ts3defines.ClientPropertiesRare.CLIENT_DATABASE_ID) group = None if status == 1: group = db.value("db_b_channelgroup") if status == 0: group = db.value("db_f_channelgroup") ts3.requestSetClientChannelGroup(schid, [group], [chid], [cdbid], self.error_setClientChannelGroup)
def onClientMoveEvent(self, schid, clid, oldChannelID, newChannelID, visibility, moveMessage): client = self.ts3host.getUser(schid, clid) # if client.server.me.channel.cid == client.cid if not client.server.me.getChannelGroupId() in [ self.tabs[schid]["channelModGroup"], client.server.defaultChannelAdminGroup ]: return if clid in self.waiting and (newChannelID == 0 or newChannelID == self.mychan): # if newChannelID == self.mychan: # (err, dbid) = ts3lib.getClientVariable(schid, clientID, ts3defines.ClientPropertiesRare.CLIENT_DATABASE_ID) ts3lib.printMessage( schid, "{}: [color=orange]Removing channel mod from {}".format( self.name, self.waiting[clid] if newChannelID == 0 else clientURL(schid, clid)), ts3defines.PluginMessageTarget.PLUGIN_MESSAGE_TARGET_SERVER) ts3lib.requestSetClientChannelGroup(schid, [self.sgid_guest], [self.mychan], [self.waiting[clid]]) del self.waiting[clid] return if newChannelID == 0 or oldChannelID != 0: return (err, sgids) = ts3lib.getClientVariableAsString( schid, clid, ts3defines.ClientPropertiesRare.CLIENT_SERVERGROUPS) if not self.sgid_guest in intList(sgids): return # TODO Any way to get the cgid in another channel? (err, uid) = ts3lib.getClientVariable( schid, clid, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER) if getContactStatus(uid) == ContactStatus.BLOCKED: ts3lib.printMessage( schid, "{}: [color=red]Not allowing blocked user {} in your channel.". format(self.name, clientURL(schid, clid)), ts3defines.PluginMessageTarget.PLUGIN_MESSAGE_TARGET_SERVER) return (err, dbid) = ts3lib.getClientVariable( schid, clid, ts3defines.ClientPropertiesRare.CLIENT_DATABASE_ID) self.waiting[clid] = dbid ts3lib.printMessage( schid, "{}: [color=green]Found new guest {} giving him channel mod until he's here ;)" .format(self.name, clientURL(schid, clid)), ts3defines.PluginMessageTarget.PLUGIN_MESSAGE_TARGET_SERVER) ts3lib.requestSetClientChannelGroup(schid, [self.cgid_mod], [self.mychan], [dbid])
def commandOP(self, schid, targetMode, toID, fromID, params=""): target = int(params) (error, dbid) = ts3lib.getClientVariableAsInt(schid, target, ts3defines.ClientPropertiesRare.CLIENT_DATABASE_ID) (error, chan) = ts3lib.getChannelOfClient(schid, target) (error, name) = ts3lib.getChannelVariableAsString(schid, chan, ts3defines.ChannelProperties.CHANNEL_NAME) error = ts3lib.requestSetClientChannelGroup(schid, [11], [chan], [dbid]) if error == ts3defines.ERROR_ok: _t = "You have been made operator of the channel [url=channelid://{0}]{1}[/url].".format(chan,name) self.answerMessage(schid, ts3defines.TextMessageTargetMode.TextMessageTarget_CLIENT, toID, target, _t)
def onChannelGroupListFinishedEvent(self, schid): try: id = self.idByName(self.tmpcgroups,self.cmdevent["params"]) if not id: self.answerMessage(schid, self.cmdevent["targetMode"], self.cmdevent["toID"], self.cmdevent["fromID"], "Failed to find a channelgroup like \"%s\""%self.cmdevent["params"]);return (error, dbid) = ts3lib.getClientVariableAsInt(schid, self.cmdevent["fromID"], ts3defines.ClientPropertiesRare.CLIENT_DATABASE_ID) (error, own) = ts3lib.getClientID(schid) (error, chan) = ts3lib.getChannelOfClient(schid, own) if self.cfg.getboolean("general", "debug"): ts3lib.printMessageToCurrentTab("dbid: {0} | own: {1} | chan: {2} | id: {3}".format(dbid,own,chan,id)) error = ts3lib.requestSetClientChannelGroup(schid, [id], [chan], [dbid]) if error == ts3defines.ERROR_ok: _t = "Successfully set your channelgroup to #{0}".format(id) else: _t = "Setting your channelgroup #{0} failed!".format(id) self.answerMessage(schid, self.cmdevent["targetMode"], self.cmdevent["toID"], self.cmdevent["fromID"], _t) except: from traceback import format_exc;ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "PyTSon", 0) self.cmdevent = {"event": "", "returnCode": "", "schid": 0, "targetMode": 4, "toID": 0, "fromID": 0, "params": ""}
def restrictForeigners(self, schid, clid): (err, cldbid) = ts3lib.getClientVariable( schid, clid, ts3defines.ClientPropertiesRare.CLIENT_DATABASE_ID) (err, sgids) = ts3lib.getClientVariable( schid, clid, ts3defines.ClientPropertiesRare.CLIENT_SERVERGROUPS) loc_sgids = intList(self.cfg.get("restrict local", "sgids")) loc_cids = intList(self.cfg.get("restrict local", "cids")) if sgids and set(loc_sgids).issubset(sgids): for sgid in loc_sgids: ts3lib.requestServerGroupDelClient(schid, sgid, cldbid) (err, dcgid) = ts3lib.getServerVariable( schid, ts3defines.VirtualServerPropertiesRare. VIRTUALSERVER_DEFAULT_CHANNEL_GROUP) ts3lib.requestSetClientChannelGroup(schid, [dcgid] * len(loc_cids), loc_cids, [cldbid] * len(loc_cids)) return for sgid in loc_sgids: ts3lib.requestServerGroupAddClient(schid, sgid, cldbid) ts3lib.requestSetClientChannelGroup( schid, [self.cfg.getint("restrict local", "cgid")] * len(loc_cids), loc_cids, [cldbid] * len(loc_cids)) msg = self.cfg.get("restrict local", "poke") if msg: ts3lib.requestClientPoke(schid, self.last_joined_channel, msg)
def onClientDBIDfromUIDEvent(self, schid, uniqueClientIdentifier, clientDatabaseID): if self.toggle: if self.check: _cid = self.requestedC.pop(0) if _cid == 0 and self.autoMod: ts3lib.requestSetClientChannelGroup(schid, [self.smgroup]*len(self.ownchannels), self.ownchannels, [clientDatabaseID]*len(self.ownchannels)) ts3lib.printMessageToCurrentTab("[color=green]Gave Client "+self.clientURL(schid, None, uniqueClientIdentifier)+" Channel Mod in #"+str(self.ownchannels)+"[/color]") elif _cid == 1 and self.autoBan: ts3lib.requestSetClientChannelGroup(schid, [self.sbgroup]*len(self.ownchannels), self.ownchannels, [clientDatabaseID]*len(self.ownchannels)) ts3lib.printMessageToCurrentTab("[color=red]Banned Client "+self.clientURL(schid, None, uniqueClientIdentifier)+" from Channels #"+str(self.ownchannels)+"[/color]") elif self.checkcurrent == uniqueClientIdentifier: ts3lib.requestSetClientChannelGroup(schid, [self.sbgroup]*len(self.ownchannels), self.ownchannels, [clientDatabaseID]*len(self.ownchannels)) self.checkcurrent = "" ts3lib.printMessageToCurrentTab("[color=orange]KickBanned Client "+self.clientURL(schid, None, uniqueClientIdentifier)+" from Channels #"+str(self.ownchannels)+"[/color]")
def onMenuItemEvent(self, schid, atype, menuItemID, selectedItemID): try: if atype == ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_GLOBAL: if menuItemID == 1: # Message all Clients (error, clients) = ts3lib.getClientList(schid) msgs = self.getText(multiline=True,title="Message all %s clients on this server"%len(clients),text="Enter Private Message") if bool(self.ok) != True:return (error, ownID) = ts3lib.getClientID(schid) for c in clients: if c == ownID: continue for msg in msgs: ts3lib.requestSendPrivateTextMsg(schid, msg, c) elif menuItemID == 2: # OffineMessage all Clients (error, clients) = ts3lib.getClientList(schid) (error, ownID) = ts3lib.getClientID(schid) uids = [] for c in clients: if c == ownID: continue (error, uid) = ts3lib.getClientVariableAsString(schid, c, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER) uids.append(uid) if not self.dlg: self.dlg = MessageDialog(schid, uids) self.dlg.show();self.dlg.raise_();self.dlg.activateWindow() elif menuItemID == 3: # Message all Channels (error, channels) = ts3lib.getChannelList(schid) msgs = self.getText(multiline=True,title="Message all %s channels on this server"%len(channels),text="Enter Channel Message") (error, ownID) = ts3lib.getClientID(schid) for c in channels: error = ts3lib.requestClientMove(schid, ownID, c, "123") if not error == ts3defines.ERROR_ok: continue for msg in msgs: ts3lib.requestSendChannelTextMsg(schid, msg, c) elif menuItemID == 4: # Poke all Clients (error, clients) = ts3lib.getClientList(schid) msgs = self.getText(title="Poke all %s clients on this server"%len(clients),text="Enter Poke Message",max=100) if bool(self.ok) != True:return (error, ownID) = ts3lib.getClientID(schid) for c in clients: if c == ownID: continue for msg in msgs: ts3lib.requestClientPoke(schid, c, msg) elif menuItemID == 5: # ChannelKick all Clients (error, clients) = ts3lib.getClientList(schid) msg = self.getText(title="Kick all %s clients on this server from their channel"%len(clients),text="Enter Kick Reason",multimsg=False,max=80) if bool(self.ok) != True:return (error, ownID) = ts3lib.getClientID(schid) for c in clients: if c == ownID: continue ts3lib.requestClientKickFromChannel(schid, c, msg) elif menuItemID == 6: # ChannelBan all Clients (error, clients) = ts3lib.getClientList(schid) msg = self.getText(title="ChannelBan all %s clients on this server"%len(clients),text="Enter Kick Reason",multimsg=False,max=80) if bool(self.ok) != True:return (error, ownID) = ts3lib.getClientID(schid) for c in clients: if c == ownID: continue (error, chan) = ts3lib.getChannelOfClient(schid, selectedItemID) (error, dbid) = ts3lib.getClientVariableAsUInt64(schid, c, ts3defines.ClientPropertiesRare.CLIENT_DATABASE_ID) ts3lib.requestSetClientChannelGroup(schid, [self.sbgroup], [chan], [dbid]) ts3lib.requestClientKickFromChannel(schid, c, msg) elif menuItemID == 7: # Kick all Clients (error, clients) = ts3lib.getClientList(schid) msg = self.getText(title="Kick all %s clients from this server"%len(clients),text="Enter Kick Reason",multimsg=False,max=80) if bool(self.ok) != True:return (error, ownID) = ts3lib.getClientID(schid) for c in clients: if c == ownID: continue ts3lib.requestClientKickFromServer(schid, c, msg) elif menuItemID == 8: # Ban all Clients (error, clients) = ts3lib.getClientList(schid) msg = self.getText(title="Ban all %s clients from this server"%len(clients),text="Enter Ban Reason",multimsg=False,max=80) if bool(self.ok) != True:return (error, ownID) = ts3lib.getClientID(schid) for c in clients: if c == ownID: continue ts3lib.banclient(schid, c, -1, msg) elif menuItemID == 9: # Delete all Channels (error, channels) = ts3lib.getChannelList(schid) confirmation = self.confirm('Delete all Channels', 'Do you really want to delete all {0} channels on this server?'.format(len(channels))) if not confirmation: return for c in channels: ts3lib.requestChannelDelete(schid, c, True) elif atype == ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_CHANNEL: if menuItemID == 1: # Message all Clients (error, clients) = ts3lib.getChannelClientList(schid, selectedItemID) (err, name) = ts3lib.getChannelVariableAsString(schid, selectedItemID, ts3defines.ChannelProperties.CHANNEL_NAME) msgs = self.getText(multiline=True,title="Message to all %s clients in channel \"%s\""%(len(clients),name),text="Enter Private Message") if bool(self.ok) != True:return (error, ownID) = ts3lib.getClientID(schid) for c in clients: if c == ownID: continue for msg in msgs: ts3lib.requestSendPrivateTextMsg(schid, msg, c) if menuItemID == 2: # OfflineMessage all Clients (error, clients) = ts3lib.getChannelClientList(schid, selectedItemID) (error, ownID) = ts3lib.getClientID(schid) uids = [] for c in clients: if c == ownID: continue (error, uid) = ts3lib.getClientVariableAsString(schid, c, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER) uids.append(uid) if not self.dlg: self.dlg = MessageDialog(schid, uids) self.dlg.show();self.dlg.raise_();self.dlg.activateWindow() elif menuItemID == 3: # Poke all Clients (error, clients) = ts3lib.getChannelClientList(schid, selectedItemID) (err, name) = ts3lib.getChannelVariableAsString(schid, selectedItemID, ts3defines.ChannelProperties.CHANNEL_NAME) msgs = self.getText(title="Poke all %s clients in channel \"%s\""%(len(clients),name),text="Enter Poke Message",max=100) if bool(self.ok) != True:return (error, ownID) = ts3lib.getClientID(schid) for c in clients: if c == ownID: continue for msg in msgs: ts3lib.requestClientPoke(schid, c, msg) elif menuItemID == 4: # ChannelKick all Clients (error, clients) = ts3lib.getChannelClientList(schid,selectedItemID) (err, name) = ts3lib.getChannelVariableAsString(schid, selectedItemID, ts3defines.ChannelProperties.CHANNEL_NAME) msg = self.getText(title="Kick all %s clients from channel \"%s\""%(len(clients),name),text="Enter Kick Reason",multimsg=False,max=80) if bool(self.ok) != True:return (error, ownID) = ts3lib.getClientID(schid) for c in clients: if c == ownID: continue ts3lib.requestClientKickFromChannel(schid, c, msg) elif menuItemID == 5: # ChannelBan all Clients (error, clients) = ts3lib.getChannelClientList(schid,selectedItemID) (err, name) = ts3lib.getChannelVariableAsString(schid, selectedItemID, ts3defines.ChannelProperties.CHANNEL_NAME) msg = self.getText(title="ChannelBan all %s clients from channel \"%s\""%(len(clients),name),text="Enter Kick Reason",multimsg=False,max=80) if bool(self.ok) != True:return (error, ownID) = ts3lib.getClientID(schid) for c in clients: if c == ownID: continue (error, dbid) = ts3lib.getClientVariableAsUInt64(schid, c, ts3defines.ClientPropertiesRare.CLIENT_DATABASE_ID) ts3lib.requestSetClientChannelGroup(schid, [self.sbgroup], [selectedItemID], [dbid]) ts3lib.requestClientKickFromChannel(schid, c, msg) elif menuItemID == 6: # Kick all Clients (error, clients) = ts3lib.getChannelClientList(schid,selectedItemID) (err, name) = ts3lib.getChannelVariableAsString(schid, selectedItemID, ts3defines.ChannelProperties.CHANNEL_NAME) msg = self.getText(title="Kick all %s clients in channel \"%s\" from this server"%(len(clients),name),text="Enter Kick Reason",multimsg=False,max=80) if bool(self.ok) != True:return (error, ownID) = ts3lib.getClientID(schid) for c in clients: if c == ownID: continue ts3lib.requestClientKickFromServer(schid, c, msg) elif menuItemID == 7: # Ban all Clients (error, clients) = ts3lib.getChannelClientList(schid,selectedItemID) (err, name) = ts3lib.getChannelVariableAsString(schid, selectedItemID, ts3defines.ChannelProperties.CHANNEL_NAME) msg = self.getText(title="Ban all %s clients in channel \"%s\""%(len(clients),name),text="Enter Ban Reason",multimsg=False,max=80) if bool(self.ok) != True:return (error, ownID) = ts3lib.getClientID(schid) for c in clients: if c == ownID: continue ts3lib.banclient(schid, c, -1, msg) except: from traceback import format_exc;ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "pyTSon", 0)