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 onConnectStatusChangeEvent(self, schid, status, errorNumber):
        if status != ts3defines.ConnectStatus.STATUS_CONNECTION_ESTABLISHED:
            return
        
        (err, mynick) = ts3.getClientSelfVariableAsString(schid, ts3defines.ClientProperties.CLIENT_NICKNAME)
        if err != ts3defines.ERROR_ok:
            return

        sp = re.split(r"\d", mynick)
        if len(sp) > 1 and sp[0] != mynick and sp[1] == "":
            (err, clis) = ts3.getClientList(schid)
            if err == ts3defines.ERROR_ok:
                for cli in clis:
                    (err, nick) = ts3.getClientVariableAsString(schid, cli, ts3defines.ClientProperties.CLIENT_NICKNAME)
                    if err == ts3defines.ERROR_ok and nick == sp[0]:
                        ts3.requestClientKickFromServer(schid, cli, "Bye bye, old me")
                        ts3.setClientSelfVariableAsString(schid, ts3defines.ClientProperties.CLIENT_NICKNAME, sp[0])
                        ts3.flushClientSelfUpdates(schid)
                        return
Example #3
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 #4
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 #5
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()