示例#1
0
 def backup(self, serverConnectionHandlerID):
     ownID = ts3lib.getClientID(serverConnectionHandlerID)[1]
     ip = ts3lib.getConnectionVariableAsString(
         serverConnectionHandlerID, ownID,
         ts3defines.ConnectionProperties.CONNECTION_SERVER_IP)[1]
     self.cfg['data']['ip'] = ip
     port = ts3lib.getConnectionVariableAsUInt64(
         serverConnectionHandlerID, ownID,
         ts3defines.ConnectionProperties.CONNECTION_SERVER_PORT)[1]
     self.cfg['data']['port'] = str(port)
     serverPassword = ts3lib.getServerConnectInfo(serverConnectionHandlerID,
                                                  256)[3]
     self.currentServerPW = serverPassword
     nickname = ts3lib.getClientSelfVariableAsString(
         serverConnectionHandlerID,
         ts3defines.ClientProperties.CLIENT_NICKNAME)[1]
     self.cfg.set('data', 'nickname', nickname)
     tabID = ts3defines.PluginConnectTab.PLUGIN_CONNECT_TAB_CURRENT
     self.cfg['data']['tabID'] = str(tabID)
     channelID = ts3lib.getChannelOfClient(serverConnectionHandlerID,
                                           ownID)[1]
     channelPassword = ts3lib.getChannelConnectInfo(
         serverConnectionHandlerID, channelID, 256)[2]
     self.currentChannelPW = channelPassword
     return
示例#2
0
 def onConnectStatusChangeEvent(self, schid, newStatus, errorNumber):
     if newStatus == ts3defines.ConnectStatus.STATUS_CONNECTED:
         (error, ownID) = ts3lib.getClientID(schid)
         (error, ip) = ts3lib.getConnectionVariableAsString(
             schid, ownID,
             ts3defines.ConnectionProperties.CONNECTION_SERVER_IP)
         self.cfg.set('data', 'ip', ip)
         (error, port) = ts3lib.getConnectionVariableAsInt(
             schid, ownID,
             ts3defines.ChannelProperties.CONNECTION_SERVER_PORT)
         self.cfg.set('data', 'ip', port)
         (error, nickname) = ts3lib.getClientSelfVariableAsString(
             schid, ts3defines.ClientProperties.CLIENT_NICKNAME)
         self.cfg.set('data', 'nickname', nickname)
     elif newStatus == ts3defines.ConnectStatus.STATUS_CONNECTION_ESTABLISHED:
         pass
示例#3
0
 def checkVars(self, schid, clid):
     (err, ownID) = ts3lib.getClientID(schid)
     (err, uid) = ts3lib.getClientVariable(
         schid, clid, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
     if ownID == clid:
         (err, uid) = ts3lib.getClientSelfVariable(
             schid, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
     if err != ts3defines.ERROR_ok or not uid: uid = False
     (err, mytsid) = ts3lib.getClientVariable(schid, clid, 61)
     if ownID == clid:
         (err, mytsid) = ts3lib.getClientSelfVariableAsString(schid, 61)
     if err != ts3defines.ERROR_ok or not mytsid: mytsid = False
     (err, ip) = ts3lib.getConnectionVariable(
         schid, clid, ts3defines.ConnectionProperties.CONNECTION_CLIENT_IP)
     if err != ts3defines.ERROR_ok or not ip: ip = False
     return uid, mytsid, ip
示例#4
0
    def onTextMessageEvent(self, schid, targetMode, toID, fromID, fromName,
                           fromUID, message, ffIgnored):
        (err, myid) = ts3lib.getClientID(schid)
        if err != ERROR_ok or fromID == myid:
            return False

        #only private msgs
        if targetMode != TextMessageTargetMode.TextMessageTarget_CLIENT:
            return False

        #only, if I'm away
        (err, away) = ts3lib.getClientSelfVariableAsInt(
            schid, ClientPropertiesRare.CLIENT_AWAY)
        if err != ERROR_ok or not away:
            return False

        #only to friends? is from friend?
        if self.cfg['general']['onlyfriends'] == "True" and not isFriend(
                fromUID):
            return False

        #only once per conversation? did we already sent him?
        if self.cfg['general']['onlyonce'] == "True" and (
                schid, fromUID) in self.handled:
            return False

        if self.cfg['general']['sendaway'] == "True":
            (err, msg) = ts3lib.getClientSelfVariableAsString(
                schid, ClientPropertiesRare.CLIENT_AWAY_MESSAGE)
        else:
            msg = self.cfg['general']['custommsg']

        if msg == "":
            return False

        err = ts3lib.requestSendPrivateTextMsg(schid, msg, fromID)
        if err == ERROR_ok:
            self.handled.append((schid, fromUID))
示例#5
0
 def processCommand(self, schid, keyword):
     args = keyword.split()
     cmd = args.pop(0).lower()
     if cmd == "com":
         command = " ".join(args)
         self.retcode = ts3lib.createReturnCode(); self.schid = schid
         err = ts3lib.requestSendClientQueryCommand(schid, command, self.retcode)
         if err != ts3defines.ERROR_ok:
             (_err, msg) = ts3lib.getErrorMessage(err)
             ts3lib.printMessageToCurrentTab("(%s) %s: %s"%(schid, command, msg))
     elif cmd == "req":
         clid = int(args.pop(0))
         self.req = clid
         ts3lib.requestClientVariables(schid, clid)
     elif cmd == "reqcon":
         clid = int(args.pop(0))
         self.req = clid
         ts3lib.requestConnectionInfo(schid, clid)
     elif cmd == "self":
         err, clid = ts3lib.getClientID(schid)
         ts3lib.printMessageToCurrentTab("[b]{}'s Self Variables:".format(clientURL(schid, clid)))
         open(self.filepath, 'w').close()
         min=0;max=64
         if len(args):
             min = int(args.pop(0))
             if len(args): max = int(args.pop(0))
         for i in range(min, max):
             msg = "%s"%i
             values = set(item.value for item in ts3enums.ClientProperties)
             if i in values: msg += " ({})".format(ts3enums.ClientProperties(i))
             msg += ": "
             (err, var) = ts3lib.getClientSelfVariableAsString(schid, i)
             if err != ts3defines.ERROR_ok:
                 (_err, var) = ts3lib.getErrorMessage(err)
             msg += var
             with open(self.filepath, "a", encoding="utf-8") as myfile:
                 myfile.write(msg+"\n")
             ts3lib.printMessageToCurrentTab(msg)
     elif cmd == "client":
         clid = int(args.pop(0))
         ts3lib.printMessageToCurrentTab("[b]{}'s Client Variables:".format(clientURL(schid, clid)))
         open(self.filepath, 'w').close()
         min=0;max=64
         if len(args):
             min = int(args.pop(0))
             if len(args): max = int(args.pop(0))
         for i in range(min, max):
             msg = "%s"%i
             values = set(item.value for item in ts3enums.ClientProperties)
             if i in values: msg += " ({})".format(ts3enums.ClientProperties(i))
             msg += ": "
             (err, var) = ts3lib.getClientVariableAsString(schid, clid, i)
             if err != ts3defines.ERROR_ok:
                 (_err, var) = ts3lib.getErrorMessage(err)
             msg += var
             with open(self.filepath, "a", encoding="utf-8") as myfile:
                 myfile.write(msg+"\n")
             ts3lib.printMessageToCurrentTab(msg)
     elif cmd == "con":
         clid = int(args.pop(0))
         ts3lib.printMessageToCurrentTab("[b]{}'s Connection Variables:".format(clientURL(schid, clid)))
         open(self.filepath, 'w').close()
         min=0;max=65
         if len(args):
             min = int(args.pop(0))
             if len(args): max = int(args.pop(0))
         for i in range(min, max):
             msg = "%s"%i
             values = set(item.value for item in ts3enums.ConnectionProperties)
             if i in values: msg += " ({})".format(ts3enums.ConnectionProperties(i))
             msg += ": "
             (err, var) = ts3lib.getConnectionVariableAsString(schid, clid, i)
             if err != ts3defines.ERROR_ok:
                 (_err, var) = ts3lib.getErrorMessage(err)
             msg += var
             with open(self.filepath, "a", encoding="utf-8") as myfile:
                 myfile.write(msg+"\n")
             ts3lib.printMessageToCurrentTab(msg)
     else: return False
     return True