def onMenuItemEvent(self, schid, atype, menuItemID, selectedItemID): if atype == ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_CHANNEL: if menuItemID == 0: self.channel = selectedItemID ts3lib.printMessageToCurrentTab('[{:%Y-%m-%d %H:%M:%S}] '.format(datetime.now())+" Set target channel to [color=yellow]"+str(self.channel)+"[/color]") elif menuItemID == 1: (e, cgid) = ts3lib.getServerVariableAsUInt64(schid, ts3defines.VirtualServerPropertiesRare.VIRTUALSERVER_DEFAULT_CHANNEL_GROUP) x = QDialog() x.setAttribute(Qt.WA_DeleteOnClose) dbid = QInputDialog.getInt(x, "Manually change channel group", "Enter DBID", QLineEdit.Normal) if self.channel == 0: (e, ownID) = ts3lib.getClientID(schid) (e, self.channel) = ts3lib.getChannelOfClient(schid, ownID) name = "DBID: %s"%dbid if self.debug: ts3lib.printMessageToCurrentTab("toggle: {0} | debug: {1} | channel: {2} | groups: {3} | dbid: {4} | name: {5}".format(self.toggle,self.debug,self.channel,self.groups,dbid,name)) ts3lib.printMessageToCurrentTab("schid: {0} | cgid: {1} | dbid: {2}".format(schid,cgid,dbid)) if not self.dlg: self.dlg = ChannelGroupDialog(schid, cgid, dbid, name, self.channel, self.groups) self.dlg.show();self.dlg.raise_();self.dlg.activateWindow() elif atype == ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_CLIENT: if menuItemID == 0: if self.channel == 0: (e, ownID) = ts3lib.getClientID(schid) (e, self.channel) = ts3lib.getChannelOfClient(schid, ownID) (e, dbid) = ts3lib.getClientVariableAsUInt64(schid, selectedItemID, ts3defines.ClientPropertiesRare.CLIENT_DATABASE_ID) (e, cgid) = ts3lib.getClientVariableAsUInt64(schid, selectedItemID, ts3defines.ClientPropertiesRare.CLIENT_CHANNEL_GROUP_ID) (e, name) = ts3lib.getClientVariableAsString(schid, selectedItemID, ts3defines.ClientProperties.CLIENT_NICKNAME) if self.debug: ts3lib.printMessageToCurrentTab("toggle: {0} | debug: {1} | channel: {2} | groups: {3} | dbid: {4} | name: {5}".format(self.toggle,self.debug,self.channel,self.groups,dbid,name)) if not self.dlg: self.dlg = ChannelGroupDialog(schid, cgid, dbid, name, self.channel, self.groups) self.dlg.show();self.dlg.raise_();self.dlg.activateWindow()
def defaultServerGroup(self): (err, gid) = ts3lib.getServerVariableAsUInt64( self.schid, ts3defines.VirtualServerPropertiesRare. VIRTUALSERVER_DEFAULT_SERVER_GROUP) if err != ts3defines.ERROR_ok: raise ts3Error( "Error getting server default server group: (%s, %s)" % (err, ts3lib.getErrorMessage(err)[1])) return gid
def iconID(self): if "iconID" in self.cache: return self.cache["iconID"] err, i = ts3lib.getServerVariableAsUInt64(self.schid, ts3defines.VirtualServerPropertiesRare.VIRTUALSERVER_ICON_ID) if err != ts3defines.ERROR_ok: _errprint("Error getting server iconid", err, self.schid) return 0 else: if i < 0: i = pow(2, 32) + i self.cache["iconID"] = i return i
def iconID(self): if "iconID" in self.cache: return self.cache["iconID"] err, i = ts3lib.getServerVariableAsUInt64( self.schid, ts3defines.VirtualServerPropertiesRare.VIRTUALSERVER_ICON_ID) if err != ts3defines.ERROR_ok: _errprint("Error getting server iconid", err, self.schid) return 0 else: if i < 0: i = pow(2, 32) + i self.cache["iconID"] = i return i