Beispiel #1
0
    def onClientPokeEvent(self, serverConnectionHandlerID, fromClientID,
                          pokerName, pokerUID, message, ffIgnored):
        #is it me?
        (err, schids) = ts3.getServerConnectionHandlerList()
        if err == ts3defines.ERROR_ok:
            for schid in schids:
                (err, myid) = ts3.getClientID(schid)
                if err == ts3defines.ERROR_ok:
                    if fromClientID == myid:
                        return 0
                else:
                    ts3.printMessageToCurrentTab("error getting own client id")
        else:
            ts3.printMessageToCurrentTab("error getting schids")

        (err, name) = ts3.getClientVariableAsString(
            serverConnectionHandlerID, fromClientID,
            ts3defines.ClientProperties.CLIENT_NICKNAME)
        if err != ts3defines.ERROR_ok:
            err = ts3.requestClientPoke(serverConnectionHandlerID,
                                        fromClientID, "Ne!")
        else:
            err = ts3.requestClientPoke(serverConnectionHandlerID,
                                        fromClientID, "%s? Ne!" % name)

        self.lastpoker = (serverConnectionHandlerID, fromClientID)

        if err != ts3defines.ERROR_ok:
            ts3.printMessageToCurrentTab("poke error: %d" % err)
            return 0
        else:
            return 1
Beispiel #2
0
 def onMenuItemEvent(self, schid, atype, menuItemID, selectedItemID):
     if atype == ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_GLOBAL:
         if menuItemID == 0:
             self.toggle = not self.toggle
             ts3.printMessageToCurrentTab(
                 '[{:%Y-%m-%d %H:%M:%S}] '.format(datetime.datetime.now()) +
                 " Set Auto Channel Commander to [color=yellow]" +
                 str(self.toggle) + "[/color]")
     elif atype == ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_CHANNEL:
         if menuItemID == 0:
             self.ownchannels.extend([selectedItemID])
             ts3.printMessageToCurrentTab("[color=green]Added[/color] #" +
                                          str(selectedItemID) +
                                          " to list of channels: " +
                                          str(self.ownchannels))
         elif menuItemID == 1:
             self.ownchannels.remove(selectedItemID)
             ts3.printMessageToCurrentTab("[color=red]Removed[/color] #" +
                                          str(selectedItemID) +
                                          " from list of channels: " +
                                          str(self.ownchannels))
     elif atype == ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_CLIENT:
         if menuItemID == 0:
             schid = ts3.getCurrentServerConnectionHandlerID()
             (error, uid) = ts3.getClientVariableAsString(
                 schid, selectedItemID,
                 ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
             _i = self.checkUser(uid)
             ts3.printMessageToCurrentTab("Client " + str(uid) + " = " +
                                          _i)  # IMPORTANT
Beispiel #3
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
Beispiel #4
0
        def onTalkStatusChangeEvent(self, serverConnectionHandlerID, status,
                                    isReceivedWhisper, clientID):
            if status == ts3defines.TalkStatus.STATUS_TALKING:
                if (serverConnectionHandlerID, clientID) in self.talkerids:
                    return
                (err, name) = ts3.getClientVariableAsString(
                    serverConnectionHandlerID, clientID,
                    ts3defines.ClientProperties.CLIENT_NICKNAME)
                if err == ts3defines.ERROR_ok:
                    self.talkerids.append(
                        (serverConnectionHandlerID, clientID))
                    self.talkernames.append(name)

            elif status == ts3defines.TalkStatus.STATUS_NOT_TALKING:
                if (serverConnectionHandlerID, clientID) not in self.talkerids:
                    return

                self.talkernames.pop(
                    self.talkerids.index(
                        (serverConnectionHandlerID, clientID)))
                self.talkerids.remove((serverConnectionHandlerID, clientID))
            else:
                return

            self.updateDisplay()
Beispiel #5
0
 def onClientMoveEvent(self, serverConnectionHandlerID, clientID,
                       oldChannelID, newChannelID, visibility, moveMessage):
     if self.toggle:
         (error, _clid) = ts3.getClientID(serverConnectionHandlerID)
         if clientID != _clid and oldChannelID == 0:
             schid = ts3.getCurrentServerConnectionHandlerID()
             (error, uid) = ts3.getClientVariableAsString(
                 schid, clientID,
                 ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
             self.checkUser(uid)
Beispiel #6
0
 def checkAllUsers(self):
     if self.toggle:
         _schid = ts3.getCurrentServerConnectionHandlerID()
         (error, _clid) = ts3.getClientID(_schid)
         (error, cl) = ts3.getClientList(_schid)
         for user in cl:
             if user != _clid:
                 (error, uid) = ts3.getClientVariableAsString(
                     _schid, user,
                     ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
                 self.checkUser(uid)
Beispiel #7
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()
Beispiel #8
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
Beispiel #9
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
Beispiel #10
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()
Beispiel #11
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."]
Beispiel #12
0
    def infoData(cls, schid, id, atype):
        i = []
        schid = ts3.getCurrentServerConnectionHandlerID()
        if atype == 0:
            i.append('{:%Y-%m-%d %H:%M:%S}'.format(datetime.datetime.now()))
            i.append('Type: [b]Server[/b]')
            i.append("Server Connection Handler ID: " + str(schid))
            #ts3.requestServerVariables(schid)
            (error, id) = ts3.getServerVariableAsString(
                schid, ts3defines.VirtualServerPropertiesRare.VIRTUALSERVER_ID)
            if error == ts3defines.ERROR_ok:
                i.append("Virtualserver ID: " + id)
            (error, mid) = ts3.getServerVariableAsString(
                schid, ts3defines.VirtualServerPropertiesRare.
                VIRTUALSERVER_MACHINE_ID)
            if error == ts3defines.ERROR_ok:
                i.append("Machine ID: " + mid)
            (error, uid) = ts3.getServerVariableAsString(
                schid, ts3defines.VirtualServerProperties.
                VIRTUALSERVER_UNIQUE_IDENTIFIER)
            if error == ts3defines.ERROR_ok:
                i.append("Unique ID: " + uid)
            (error, gip) = ts3.getServerVariableAsString(
                schid, ts3defines.VirtualServerPropertiesRare.VIRTUALSERVER_IP)
            if error == ts3defines.ERROR_ok:
                i.append("IP: " + gip)
            (error, clid) = ts3.getClientID(schid)
            if error == ts3defines.ERROR_ok:
                (error, ip) = ts3.getConnectionVariableAsString(schid, clid, 6)
                if error == ts3defines.ERROR_ok and ip != gip:
                    i.append("Connect IP: " + ip)

            (error, created) = ts3.getServerVariableAsString(
                schid,
                ts3defines.VirtualServerProperties.VIRTUALSERVER_CREATED)
            if error == ts3defines.ERROR_ok:
                created = datetime.datetime.fromtimestamp(
                    int(created)).strftime('%Y-%m-%d %H:%M:%S')
                i.append("Created: " + str(created))

            (error, mbu) = ts3.getServerVariableAsString(
                schid, ts3defines.VirtualServerPropertiesRare.
                VIRTUALSERVER_MONTH_BYTES_UPLOADED)
            (error, mbd) = ts3.getServerVariableAsString(
                schid, ts3defines.VirtualServerPropertiesRare.
                VIRTUALSERVER_MONTH_BYTES_DOWNLOADED)
            if error == ts3defines.ERROR_ok:
                i.append("Monthly Traffic: Up: [color=blue]" + mbu +
                         "[/color] B | Down: [color=red]" + mbd + "[/color] B")
            (error, tbu) = ts3.getServerVariableAsString(
                schid, ts3defines.VirtualServerPropertiesRare.
                VIRTUALSERVER_TOTAL_BYTES_UPLOADED)
            (error, tbd) = ts3.getServerVariableAsString(
                schid, ts3defines.VirtualServerPropertiesRare.
                VIRTUALSERVER_TOTAL_BYTES_DOWNLOADED)
            if error == ts3defines.ERROR_ok:
                i.append("Total Traffic: Up: [color=darkblue]" + tbu +
                         "[/color] B | Down: [color=firebrick]" + tbd +
                         "[/color] B")
            (error, tpt) = ts3.getServerVariableAsString(
                schid, ts3defines.VirtualServerPropertiesRare.
                VIRTUALSERVER_TOTAL_PACKETLOSS_TOTAL)
            (error, tpk) = ts3.getServerVariableAsString(
                schid, ts3defines.VirtualServerPropertiesRare.
                VIRTUALSERVER_TOTAL_PACKETLOSS_KEEPALIVE)
            (error, tpc) = ts3.getServerVariableAsString(
                schid, ts3defines.VirtualServerPropertiesRare.
                VIRTUALSERVER_TOTAL_PACKETLOSS_CONTROL)
            (error, tps) = ts3.getServerVariableAsString(
                schid, ts3defines.VirtualServerPropertiesRare.
                VIRTUALSERVER_TOTAL_PACKETLOSS_SPEECH)
            if error == ts3defines.ERROR_ok:
                i.append("Loss Total: [color=magenta]" + tpt +
                         "[/color]% | Keepalive: [color=magenta]" + tpk +
                         "[/color]% | Control: [color=magenta]" + tpc +
                         "[/color]% | Speech: [color=magenta]" + tps +
                         "[/color]%")
            (error, ping) = ts3.getServerVariableAsString(
                schid, ts3defines.VirtualServerPropertiesRare.
                VIRTUALSERVER_TOTAL_PING)
            if error == ts3defines.ERROR_ok:
                i.append("Ping: " + ping + "ms")
            (error, icon) = ts3.getServerVariableAsString(
                schid,
                ts3defines.VirtualServerPropertiesRare.VIRTUALSERVER_ICON_ID)
            if error == ts3defines.ERROR_ok:
                i.append('Icon ID: ' + icon)
            (error, aptr) = ts3.getServerVariableAsString(
                schid, ts3defines.VirtualServerPropertiesRare.
                VIRTUALSERVER_ANTIFLOOD_POINTS_TICK_REDUCE)
            if error == ts3defines.ERROR_ok:
                i.append("Points per tick: " + aptr)
            (error, apncb) = ts3.getServerVariableAsString(
                schid, ts3defines.VirtualServerPropertiesRare.
                VIRTUALSERVER_ANTIFLOOD_POINTS_NEEDED_COMMAND_BLOCK)
            if error == ts3defines.ERROR_ok:
                i.append("Points to block commands: " + apncb)
            (error, apnib) = ts3.getServerVariableAsString(
                schid, ts3defines.VirtualServerPropertiesRare.
                VIRTUALSERVER_ANTIFLOOD_POINTS_NEEDED_IP_BLOCK)
            if error == ts3defines.ERROR_ok:
                i.append("Points to block IP: " + apnib)
            return i
        elif atype == 1:
            i.append('{:%Y-%m-%d %H:%M:%S}'.format(datetime.datetime.now()))
            i.append('Type: [b]Channel[/b]')
            (error, phonick) = ts3.getChannelVariableAsString(
                schid, id,
                ts3defines.ChannelPropertiesRare.CHANNEL_NAME_PHONETIC)
            if error == ts3defines.ERROR_ok and phonick != "":
                i.append("Phonetic Nickname: " + phonick)
            (error, icon) = ts3.getChannelVariableAsString(
                schid, id, ts3defines.ChannelPropertiesRare.CHANNEL_ICON_ID)
            if error == ts3defines.ERROR_ok and icon != "0":
                i.append("Icon ID: " + icon)
            (error, forcedsilence) = ts3.getChannelVariableAsInt(
                schid, id,
                ts3defines.ChannelPropertiesRare.CHANNEL_FORCED_SILENCE)
            if error == ts3defines.ERROR_ok:
                if forcedsilence == 1:
                    i.append("Forced Silence: [color=red]YES[/color]")
                else:
                    i.append("Forced Silence: [color=green]NO[/color]")
            (error, private) = ts3.getChannelVariableAsString(
                schid, id,
                ts3defines.ChannelPropertiesRare.CHANNEL_FLAG_PRIVATE)
            if error == ts3defines.ERROR_ok:
                if private == 1:
                    i.append("Private Channel: [color=red]YES[/color]")
                else:
                    i.append("Private Channel: [color=green]NO[/color]")
            (error, latency) = ts3.getChannelVariableAsString(
                schid, id,
                ts3defines.ChannelProperties.CHANNEL_CODEC_LATENCY_FACTOR)
            if error == ts3defines.ERROR_ok:
                i.append("Latency Factor: " + latency)
            (error, salt) = ts3.getChannelVariableAsString(
                schid, id, ts3defines.ChannelProperties.CHANNEL_SECURITY_SALT)
            if error == ts3defines.ERROR_ok and salt != "":
                i.append("Security Salt: " + salt)
            (error, pwd) = ts3.getChannelVariableAsString(
                schid, id, ts3defines.ChannelProperties.CHANNEL_PASSWORD)
            if error == ts3defines.ERROR_ok and pwd != "" and pwd != "dummy":
                i.append("Password: "******"":
                i.append("Filepath: " + filepath)
            return i
        elif atype == 2:
            i.append('{:%Y-%m-%d %H:%M:%S}'.format(datetime.datetime.now()))
            #ts3.requestClientVariables(schid, id)#ts3.requestConnectioni(schid, id)
            (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]')

            (error, country) = ts3.getClientVariableAsString(
                schid, id, ts3defines.ClientPropertiesRare.CLIENT_COUNTRY)
            if error == ts3defines.ERROR_ok:
                #if colored:
                i.append("Country: [color=darkgreen]" + country + "[/color]")
            #else:
            #i.append("Country: "+country)
            (error, phonick) = ts3.getClientVariableAsString(
                schid, id,
                ts3defines.ClientPropertiesRare.CLIENT_NICKNAME_PHONETIC)
            if error == ts3defines.ERROR_ok and phonick != "":
                i.append("Phonetic Nick: " + phonick)
            (error, unread) = ts3.getClientVariableAsInt(
                schid, id,
                ts3defines.ClientPropertiesRare.CLIENT_UNREAD_MESSAGES)
            if error == ts3defines.ERROR_ok:
                if unread == 0:
                    i.append("No unread offline messages.")
                else:
                    i.append("[color=blue][b]" + str(unread) +
                             "[/b][/color] unread offline messages")
            (error, icon) = ts3.getClientVariableAsString(
                schid, id, ts3defines.ClientPropertiesRare.CLIENT_ICON_ID)
            if error == ts3defines.ERROR_ok and icon != "0":
                i.append("Icon ID: " + icon)
            (error, tp) = ts3.getClientVariableAsString(
                schid, id, ts3defines.ClientPropertiesRare.CLIENT_TALK_POWER)
            if error == ts3defines.ERROR_ok:
                i.append("Talk Power: " + tp)
            (error, avatar) = ts3.getClientVariableAsString(
                schid, id, ts3defines.ClientPropertiesRare.CLIENT_FLAG_AVATAR)
            if error == ts3defines.ERROR_ok and avatar != "":
                i.append("Avatar Flag: " + avatar)
            (error, cgid) = ts3.getClientVariableAsString(
                schid, id,
                ts3defines.ClientPropertiesRare.CLIENT_CHANNEL_GROUP_ID)
            if error == ts3defines.ERROR_ok:
                i.append("Channel Group: " + cgid)
            (error, sgids) = ts3.getClientVariableAsString(
                schid, id, ts3defines.ClientPropertiesRare.CLIENT_SERVERGROUPS)
            if error == ts3defines.ERROR_ok:
                i.append("Server Groups: " + sgids)
            (error, sqnvp) = ts3.getClientVariableAsString(
                schid, id, ts3defines.ClientPropertiesRare.
                CLIENT_NEEDED_SERVERQUERY_VIEW_POWER)
            if error == ts3defines.ERROR_ok:
                i.append("Needed SQ View Power: " + sqnvp)
            (error, clb) = ts3.getClientVariableAsString(
                schid, id, ts3defines.ClientPropertiesRare.CLIENT_BADGES)
            if error == ts3defines.ERROR_ok and clb != "Overwolf=0":
                i.append("Badges: " + clb)
            (error, mmbu) = ts3.getClientVariableAsString(
                schid, id,
                ts3defines.ClientPropertiesRare.CLIENT_MONTH_BYTES_UPLOADED)
            (error, mmbd) = ts3.getClientVariableAsString(
                schid, id,
                ts3defines.ClientPropertiesRare.CLIENT_MONTH_BYTES_DOWNLOADED)
            if error == ts3defines.ERROR_ok and mmbu != "0" and mmbd != "0":
                i.append("Monthly Traffic: Up: [color=blue]" + mmbu +
                         "[/color] B | Down: [color=red]" + mmbd +
                         "[/color] B")
            (error, tmbu) = ts3.getClientVariableAsString(
                schid, id,
                ts3defines.ClientPropertiesRare.CLIENT_TOTAL_BYTES_UPLOADED)
            (error, tmbd) = ts3.getClientVariableAsString(
                schid, id,
                ts3defines.ClientPropertiesRare.CLIENT_TOTAL_BYTES_DOWNLOADED)
            if error == ts3defines.ERROR_ok and tmbu != "0" and tmbd != "0":
                i.append("Total Traffic: Up: [color=darkblue]" + tmbu +
                         "[/color] B | Down: [color=firebrick]" + tmbd +
                         "[/color] B")
            (error, version) = ts3.getClientVariableAsString(
                schid, id, ts3defines.ClientProperties.CLIENT_VERSION)
            if error == ts3defines.ERROR_ok:
                i.append("Version: " + version)
            if info.meta:
                (error, meta) = ts3.getClientVariableAsString(
                    schid, id, ts3defines.ClientProperties.CLIENT_META_DATA)
                if error == ts3defines.ERROR_ok and meta != "":
                    i.append("Meta Data: " + meta)
            return i
        else:
            return ["ItemType \"" + str(atype) + "\" unknown."]
Beispiel #13
0
 def onUpdateClientEvent(self, serverConnectionHandlerID, clientID,
                         invokerID, invokerName, invokerUniqueIdentifier):
     if self.requested:
         self.requested = False
         (error, _uid) = ts3.getClientVariableAsString(
             serverConnectionHandlerID, clientID,
             ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
         if not self._sent.__contains__(_uid):
             return
         if self.checkOutdatedVersion:
             (error, targetVer) = ts3.getClientVariableAsString(
                 serverConnectionHandlerID, clientID,
                 ts3defines.ClientProperties.CLIENT_VERSION)
             if error != ts3defines.ERROR_ok:
                 return
             ts3.printMessageToCurrentTab("targetVer: " + targetVer)
             targetVer = targetVer.split("Build: ")
             targetVer = targetVer[1]
             targetVer = int(targetVer.split("]")[0])
             if targetVer < self.currentVersion:
                 (error, country) = ts3.getClientVariableAsString(
                     serverConnectionHandlerID, clientID,
                     ts3defines.ClientPropertiesRare.CLIENT_COUNTRY)
                 if country == "DE" or country == "CH" or country == "AT":
                     ts3.requestSendPrivateTextMsg(
                         serverConnectionHandlerID,
                         "[color=red]Hinweis[/color]:\n\nDu nutzt eine veraltete Version von Teamspeak.\nBitte aktualisiere deinen Client auf Version [color=blue]"
                         + self.currentVersion_ + "[/color]", clientID)
                     self._sent.extend([_uid])
                 else:
                     ts3.requestSendPrivateTextMsg(
                         serverConnectionHandlerID,
                         "[color=red]Attention[/color]:\n\nYou are using an outdated Teamspeak.\nPlease update your Client to Version [color=blue]"
                         + self.currentVersion_ + "[/color]", clientID)
                     self._sent.extend([_uid])
         if self.checkUnreadMessages:
             (error, platform) = ts3.getClientVariableAsString(
                 serverConnectionHandlerID, clientID,
                 ts3defines.ClientProperties.CLIENT_PLATFORM)
             if platform != "Android" and platform != "iOS":
                 (error, messages) = ts3.getClientVariableAsInt(
                     serverConnectionHandlerID, clientID,
                     ts3defines.ClientPropertiesRare.CLIENT_UNREAD_MESSAGES)
                 ts3.printMessageToCurrentTab("messages: " + str(messages))
                 if messages > 1:
                     (error, country) = ts3.getClientVariableAsString(
                         serverConnectionHandlerID, clientID,
                         ts3defines.ClientPropertiesRare.CLIENT_COUNTRY)
                     ts3.printMessageToCurrentTab("country: " + country)
                     if country == "DE" or country == "CH" or country == "AT":
                         ts3.requestSendPrivateTextMsg(
                             serverConnectionHandlerID,
                             "[color=orange]Hinweis[/color]:\n\nDu hast [color=blue]eine[/color] ungelesene Offline Nachricht.\nDu kannst sie nachlesen indem du auf \"Extras\" => \"Offline Nachrichten\" klickst oder einfach [STRG]+[O] auf deiner Tastatur drückst.",
                             clientID)
                         self._sent.extend([_uid])
                     else:
                         ts3.requestSendPrivateTextMsg(
                             serverConnectionHandlerID,
                             "[color=orange]Reminder[/color]:\n\nYou have [color=blue]one[/color] unread offline message.\nYou can read it by clicking on \"Tools\" => \"Offline Messages\" or pressing [CTRL]+[O] on your keyboard.",
                             clientID)
                         self._sent.extend([_uid])
                 elif messages == 1:
                     (error, country) = ts3.getClientVariableAsString(
                         serverConnectionHandlerID, clientID,
                         ts3defines.ClientPropertiesRare.CLIENT_COUNTRY)
                     if country == "DE" or country == "CH" or country == "AT":
                         ts3.requestSendPrivateTextMsg(
                             serverConnectionHandlerID,
                             "[color=orange]Hinweis[/color]:\n\nDu hast [color=blue]"
                             + str(messages) +
                             "[/color] ungelesene Offline Nachrichten.\nDu kannst sie nachlesen indem du auf \"Extras\" => \"Offline Nachrichten\" klickst oder einfach [STRG]+[O] auf deiner Tastatur drückst.",
                             clientID)
                         self._sent.extend([_uid])
                     else:
                         ts3.requestSendPrivateTextMsg(
                             serverConnectionHandlerID,
                             "[color=orange]Reminder[/color]:\n\nYou have [color=blue]"
                             + str(messages) +
                             "[/color] unread offline messages.\nYou can read them by clicking on \"Tools\" => \"Offline Messages\" or pressing [CTRL]+[O] on your keyboard.",
                             clientID)
                         self._sent.extend([_uid])
Beispiel #14
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."]