Example #1
0
 def processCommand(self, schid, command):
     tokens = command.split(' ')
     if tokens[0] == "pcmd":
         ts3.sendPluginCommand(schid, tokens[1], ts3defines.PluginTargetMode.PluginCommandTarget_SERVER, []);return True
     elif tokens[0] == "meta":
         if tokens[1] == "get":
             schid = ts3.getCurrentServerConnectionHandlerID()
             error, ownid = ts3.getClientID(schid)
             if error == ts3defines.ERROR_ok:
                 # requestClientVariables(schid, ownid)
                 error, meta = ts3.getClientVariableAsString(schid, ownid, ts3defines.ClientProperties.CLIENT_META_DATA)
                 if error == ts3defines.ERROR_ok:
                     ts3.printMessageToCurrentTab(meta);return True
                 else:
                     ts3.printMessageToCurrentTab("Error: Can't get own meta data.");return True
             else:
                 ts3.printMessageToCurrentTab("Error: Can't get own clientID.");return True
         elif tokens[1] == "set":
             schid = ts3.getCurrentServerConnectionHandlerID()
             error = ts3.setClientSelfVariableAsString(schid, ts3defines.ClientProperties.CLIENT_META_DATA, tokens[2])
             if not error == ts3defines.ERROR_ok:
                 ts3.printMessageToCurrentTab("Error: Unable to set own meta data.");return True
             else: return True
     else:
         ts3.printMessageToCurrentTab("ERROR: Command \""+tokens[0]+"\" not found!");return True
     return False
Example #2
0
 def onMenuItemEvent(self, schid, atype, menuItemID, selectedItemID):
     if atype == ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_GLOBAL:
         if menuItemID == 0:
             schid = ts3.getCurrentServerConnectionHandlerID()
             error, ownid = ts3.getClientID(schid)
             if error == ts3defines.ERROR_ok:
                 error, meta = ts3.getClientVariableAsString(schid, ownid, ts3defines.ClientProperties.CLIENT_META_DATA)
                 if error == ts3defines.ERROR_ok:
                     x = QWidget()
                     meta = QInputDialog.getMultiLineText(x, "Change own Meta Data", "Meta Data:", meta)
                     error = ts3.setClientSelfVariableAsString(schid, ts3defines.ClientProperties.CLIENT_META_DATA, meta)
                     if not error == ts3defines.ERROR_ok:
                         _t = QMessageBox(QMessageBox.Critical, "Error", "Unable to set own meta data!");t.show()
Example #3
0
 def infoData(self, schid, id, atype):
     i = []
     schid = ts3.getCurrentServerConnectionHandlerID()
     if atype == 0:
         if self.cfg.getboolean('general', 'Autorequest Server Variables'):
             ts3.requestServerVariables(schid)
         for name in self.cfg['VirtualServerProperties']:
             if name == 'LAST_REQUESTED':
                 if self.cfg.getboolean('VirtualServerProperties', 'LAST_REQUESTED'):
                     i.append('{:%Y-%m-%d %H:%M:%S}'.format(datetime.datetime.now()))
             elif name == 'TYPE':
                 if self.cfg.getboolean('VirtualServerProperties', 'TYPE'):
                     i.append('Type: [b]Server[/b]')
             else:
                 try:
                     if self.cfg.getboolean('VirtualServerProperties', name):
                         _tmp = eval('ts3defines.VirtualServerProperties.'+name)
                         (error, _var) = ts3.getServerVariableAsString(schid, _tmp)
                         if error == ts3defines.ERROR_ok and _var and not str(_var) == "0" and not str(_var) == "" and not str(_var) == "0.0000":
                             i.append(name.replace('VIRTUALSERVER_', '').replace('_', ' ').title()+": "+_var)
                 except:
                     continue#ts3.logMessage('Could not look up '+name, ts3defines.LogLevel.LogLevel_ERROR, self.name, schid)
         for name in self.cfg['VirtualServerPropertiesRare']:
             try:
                 if self.cfg.getboolean('VirtualServerPropertiesRare', name):
                     _tmp = eval('ts3defines.VirtualServerPropertiesRare.'+name)
                     (error, _var) = ts3.getServerVariableAsString(schid, _tmp)
                     if error == ts3defines.ERROR_ok and _var and not str(_var) == "0" and not str(_var) == "" and not str(_var) == "0.0000":
                         i.append(name.replace('VIRTUALSERVER_', '').replace('_', ' ').title()+": "+_var)
             except:
                 continue#ts3.logMessage('Could not look up '+name, ts3defines.LogLevel.LogLevel_ERROR, self.name, schid)
         return i
     elif atype == 1:
         for name in self.cfg['ChannelProperties']:
             if name == 'LAST_REQUESTED':
                 if self.cfg.getboolean('ChannelProperties', 'LAST_REQUESTED'):
                     i.append('{:%Y-%m-%d %H:%M:%S}'.format(datetime.datetime.now()))
             elif name == 'TYPE':
                 if self.cfg.getboolean('ChannelProperties', 'TYPE'):
                     i.append('Type: [b]Channel[/b]')
             else:
                 try:
                     if self.cfg.getboolean('ChannelProperties', name):
                         _tmp = eval('ts3defines.ChannelProperties.'+name)
                         (error, _var) = ts3.getChannelVariableAsString(schid, id, _tmp)
                         if error == ts3defines.ERROR_ok and _var and not str(_var) == "0" and not str(_var) == "":
                             i.append(name.replace('CHANNEL_', '').replace('_', ' ').title()+": "+_var)
                 except:
                     continue#ts3.logMessage('Could not look up '+name, ts3defines.LogLevel.LogLevel_ERROR, self.name, schid)
         for name in self.cfg['ChannelPropertiesRare']:
             try:
                 if self.cfg.getboolean('ChannelPropertiesRare', name):
                     _tmp = eval('ts3defines.ChannelPropertiesRare.'+name)
                     (error, _var) = ts3.getChannelVariableAsString(schid, id, _tmp)
                     if error == ts3defines.ERROR_ok and _var and not str(_var) == "0" and not str(_var) == "":
                         i.append(name.replace('CHANNEL_', '').replace('_', ' ').title()+": "+_var)
             except:
                 continue#ts3.logMessage('Could not look up '+name, ts3defines.LogLevel.LogLevel_ERROR, self.name, schid)
         return i
     elif atype == 2:
         if self.cfg.getboolean('general', 'Autorequest Client Variables'):
             ts3.requestClientVariables(schid, id)
         for name in self.cfg['ClientProperties']:
             if name == 'LAST_REQUESTED':
                 if self.cfg.getboolean('ClientProperties', 'LAST_REQUESTED'):
                     i.append('{:%Y-%m-%d %H:%M:%S}'.format(datetime.datetime.now()))
             elif name == 'TYPE':
                 if self.cfg.getboolean('ClientProperties', 'TYPE'):
                     (error, type) = ts3.getClientVariableAsInt(schid, id, ts3defines.ClientPropertiesRare.CLIENT_TYPE)
                     if error == ts3defines.ERROR_ok:
                         if type == ts3defines.ClientType.ClientType_NORMAL:
                             i.append('Type: [b]Client[/b]')
                         elif type == ts3defines.ClientType.ClientType_SERVERQUERY:
                             i.append('Type: [b]ServerQuery[/b]')
                         else:
                             i.append('Type: [b]Unknown ('+str(type)+')[/b]')
             else:
                 try:
                     if self.cfg.getboolean('ClientProperties', name):
                         _tmp = eval('ts3defines.ClientProperties.'+name)
                         (error, _var) = ts3.getClientVariableAsString(schid, id, _tmp)
                         if error == ts3defines.ERROR_ok and _var and not str(_var) == "0" and not str(_var) == "":
                             i.append(name.replace('CLIENT_', '').replace('_', ' ').title()+": "+_var)
                 except:
                     continue#ts3.logMessage('Could not look up '+name, ts3defines.LogLevel.LogLevel_ERROR, self.name, schid)
         for name in self.cfg['ClientPropertiesRare']:
             try:
                 if self.cfg.getboolean('ClientPropertiesRare', name):
                     _tmp = eval('ts3defines.ClientPropertiesRare.'+name)
                     (error, _var) = ts3.getClientVariableAsString(schid, id, _tmp)
                     if error == ts3defines.ERROR_ok and _var and not str(_var) == "0" and not str(_var) == "":
                         i.append(name.replace('CLIENT_', '').replace('_', ' ').title()+": "+_var)
             except:
                 continue#ts3.logMessage('Could not look up '+name, ts3defines.LogLevel.LogLevel_ERROR, self.name, schid)
         for name in self.cfg['ConnectionProperties']:
             try:
                 if self.cfg.getboolean('ConnectionProperties', name):
                     _tmp = eval('ts3defines.ConnectionProperties.'+name)
                     (error, _var) = ts3.getConnectionVariableAsString(schid, id, _tmp)
                     if error == ts3defines.ERROR_ok and _var and not str(_var) == "0" and not str(_var) == "":
                         i.append(name.replace('CONNECTION_', '').replace('_', ' ').title()+": "+_var)
             except:
                 continue#ts3.logMessage('Could not look up '+name, ts3defines.LogLevel.LogLevel_ERROR, self.name, schid)
         for name in self.cfg['ConnectionPropertiesRare']:
             try:
                 if self.cfg.getboolean('ConnectionPropertiesRare', name):
                     _tmp = eval('ts3defines.ConnectionPropertiesRare.'+name)
                     (error, _var) = ts3.getConnectionVariableAsString(schid, id, _tmp)
                     if error == ts3defines.ERROR_ok and _var and not str(_var) == "0" and not str(_var) == "":
                         i.append(name.replace('CONNECTION_', '').replace('_', ' ').title()+": "+_var)
             except:
                 continue#ts3.logMessage('Could not look up '+name, ts3defines.LogLevel.LogLevel_ERROR, self.name, schid)
         return i
     else:
         return ["ItemType \""+str(atype)+"\" unknown."]