Exemplo n.º 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
Exemplo n.º 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()