예제 #1
0
 def dbInsert(self,
              schid,
              cid,
              clid,
              cgid,
              dbid=None,
              invokerName="",
              invokerUID=""):
     if PluginHost.cfg.getboolean("general", "verbose"):
         print("got clid:", clid)
     for v in [schid, cid, clid, cgid]:
         if v is None: return
     (err, suid) = ts3lib.getServerVariable(
         schid,
         ts3defines.VirtualServerProperties.VIRTUALSERVER_UNIQUE_IDENTIFIER)
     uuid = "{}|{}".format(suid, cid)
     self.execSQL(
         "CREATE TABLE IF NOT EXISTS `{}` (`TIMESTAMP` NUMERIC, `NAME` TEXT, `UID` TEXT, `DBID` NUMERIC UNIQUE, `CGID` NUMERIC, `INVOKERNAME` TEXT, `INVOKERUID` TEXT);"
         .format(uuid))
     (err, name) = ts3lib.getClientVariableAsString(
         schid, clid, ts3defines.ClientProperties.CLIENT_NICKNAME)
     (err, uid) = ts3lib.getClientVariableAsString(
         schid, clid, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
     if dbid is None:
         (err, dbid) = ts3lib.getClientVariableAsInt(
             schid, clid,
             ts3defines.ClientPropertiesRare.CLIENT_DATABASE_ID)
     q = "INSERT OR REPLACE INTO '{}' (TIMESTAMP, NAME, UID, DBID, CGID, INVOKERNAME, INVOKERUID) VALUES ({}, '{}', '{}', {}, {}, '{}', '{}')".format(
         uuid, int(time.time()), name, uid, dbid, cgid, invokerName,
         invokerUID)
     self.execSQL(q)
예제 #2
0
 def clientURL(self,
               schid=None,
               clid=1,
               uid=None,
               nickname=None,
               encodednick=None):
     if schid == None:
         try:
             schid = ts3lib.getCurrentServerConnectionHandlerID()
         except:
             pass
     if uid == None:
         try:
             (error, uid) = ts3lib.getClientVariableAsString(
                 schid, clid,
                 ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
         except:
             pass
     if nickname == None:
         try:
             (error, nickname) = ts3lib.getClientVariableAsString(
                 schid, clid, ts3defines.ClientProperties.CLIENT_NICKNAME)
         except:
             nickname = uid
     if encodednick == None:
         try:
             encodednick = urlencode(nickname)
         except:
             pass
     return "[url=client://{0}/{1}~{2}]{3}[/url]".format(
         clid, uid, encodednick, nickname)
예제 #3
0
 def onMenuItemEvent(self, schid, atype, menuItemID, selectedItemID):
     if atype == PluginMenuType.PLUGIN_MENU_TYPE_GLOBAL:
         if menuItemID == 0:
             error, ownid = ts3.getClientID(schid)
             if error == ERROR_ok:
                 error, meta = ts3.getClientVariableAsString(schid, ownid, ClientProperties.CLIENT_META_DATA)
                 if error == ERROR_ok:
                     x = QWidget()
                     _meta = QInputDialog.getMultiLineText(x, "Change own Meta Data", "Meta Data:", meta)
                     if _meta == meta: return
                     error = ts3.setClientSelfVariableAsString(schid, ClientProperties.CLIENT_META_DATA, _meta)
                     if not error == ERROR_ok:
                         _t = QMessageBox(QMessageBox.Critical, "Error #%s"%error, "Unable to set own meta data!");_t.show()
         elif menuItemID == 1:
             error, ownid = ts3.getClientID(schid)
             if error == ERROR_ok:
                 error, flag = ts3.getClientVariableAsString(schid, ownid, ClientPropertiesRare.CLIENT_FLAG_AVATAR)
                 ts3.printMessageToCurrentTab("Your current avatar flag is: %s"%flag)
                 if error == ERROR_ok:
                     x = QWidget()
                     _flag = QInputDialog.getText(x, "Change own Avatar Flag", "Avatar File MD5:")
                     if _flag == "x" or _flag.strip() == flag.strip(): return
                     error = ts3.setClientSelfVariableAsString(schid, ClientPropertiesRare.CLIENT_FLAG_AVATAR, _flag)
                     error2 = ts3.flushClientSelfUpdates(schid)
                     if not error == ERROR_ok or not error2 == ERROR_ok:
                         _t = QMessageBox(QMessageBox.Critical, "Error", "Unable to set own avatar flag!");_t.show()
예제 #4
0
 def onMenuItemEvent(self, schid, atype, menuItemID, selectedItemID):
     if atype == ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_CLIENT and menuItemID == 0:
         try:
             (error, uid) = ts3lib.getClientVariableAsString(schid, selectedItemID, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
             (error, name) = ts3lib.getClientVariableAsString(schid, selectedItemID, ts3defines.ClientProperties.CLIENT_NICKNAME)
             if not self.dlg: self.dlg = MessageDialog(schid, uid, name)
             self.dlg.show()
             self.dlg.raise_()
             self.dlg.activateWindow()
         except: from traceback import format_exc;ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "pyTSon", 0)
예제 #5
0
 def onClientKickFromChannelEvent(self, schid, clientID, oldChannelID, newChannelID, visibility, kickerID, kickerName, kickerUniqueIdentifier, kickMessage):
     # Own client ID and own channel
     (error, myid) = ts3.getClientID(schid)
     (error, mych) = ts3.getChannelOfClient(schid, myid)
     
     if oldChannelID == mych and not myid == kickerID:
         (error, cuid) = ts3.getClientVariableAsString(schid, clientID, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
         (error, cname) = ts3.getClientVariableAsString(schid, clientID, ts3defines.ClientProperties.CLIENT_NICKNAME)
         status = self.contactStatus(kickerUniqueIdentifier)
         kickerName_show = "[color=black]"+kickerName+"[/color]"
         if status == 0: friend = kickerName_show = "[color=#02D110]"+kickerName+"[/color]"            
         ts3.printMessage(schid, "[color=black]‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾[/color]", ts3defines.PluginMessageTarget.PLUGIN_MESSAGE_TARGET_SERVER)
         ts3.printMessage(schid, "[URL=client://"+str(clientID)+"/"+str(cuid)+"~"+cname+"][color=black]"+cname+"[/color][/URL] [color=black]was kicked by[/color] [URL=client://"+str(kickerID)+"/"+str(kickerUniqueIdentifier)+"~"+kickerName+"]"+kickerName_show+"[/URL]", ts3defines.PluginMessageTarget.PLUGIN_MESSAGE_TARGET_SERVER)
         ts3.printMessage(schid, "[color=black]_____________________________________[/color]", ts3defines.PluginMessageTarget.PLUGIN_MESSAGE_TARGET_SERVER)
예제 #6
0
 def onClientMoveEvent(self, serverConnectionHandlerID, clientID,
                       oldChannelID, newChannelID, visibility, moveMessage):
     if oldChannelID == 0:
         (err, groups) = ts3lib.getClientVariableAsString(
             serverConnectionHandlerID, clientID,
             ts3defines.ClientPropertiesRare.CLIENT_SERVERGROUPS)
         if groups[0] == "8":
             (err_name, name) = ts3lib.getClientVariableAsString(
                 serverConnectionHandlerID, clientID,
                 ts3defines.ClientProperties.CLIENT_NICKNAME)
             self.last_name = str(name)
             self.flagnm = 1
             err = ts3lib.requestClientIDs(serverConnectionHandlerID,
                                           self.myuid)
예제 #7
0
 def clientURL(self,
               schid=None,
               clid=1,
               uid=None,
               nickname=None,
               encodednick=None):
     if schid == None:
         try:
             schid = ts3.getCurrentServerConnectionHandlerID()
         except:
             pass
     if uid == None:
         try:
             (error, uid) = ts3.getClientVariableAsString(
                 schid, clid,
                 ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
         except:
             pass
     if nickname == None:
         try:
             (error, nickname) = ts3.getClientDisplayName(schid, clid)
         except:
             nickname = uid
     if encodednick == None:
         try:
             encodednick = urlencode(nickname)
         except:
             pass
     return "[url=client://%s/%s~%s]%s[/url]" % (clid, uid, encodednick,
                                                 nickname)
예제 #8
0
 def onMenuItemEvent(self, schid, atype, menuItemID, selectedItemID):
     if atype == ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_CHANNEL:
         if menuItemID == 0:
             self.channel = selectedItemID
             ts3lib.printMessageToCurrentTab('[{:%Y-%m-%d %H:%M:%S}] '.format(datetime.now())+" Set target channel to [color=yellow]"+str(self.channel)+"[/color]")
         elif menuItemID == 1:
             (e, cgid) = ts3lib.getServerVariableAsUInt64(schid, ts3defines.VirtualServerPropertiesRare.VIRTUALSERVER_DEFAULT_CHANNEL_GROUP)
             x = QDialog()
             x.setAttribute(Qt.WA_DeleteOnClose)
             dbid = QInputDialog.getInt(x, "Manually change channel group", "Enter DBID", QLineEdit.Normal)
             if self.channel == 0:
                 (e, ownID) = ts3lib.getClientID(schid)
                 (e, self.channel) = ts3lib.getChannelOfClient(schid, ownID)
             name = "DBID: %s"%dbid
             if self.debug:
                 ts3lib.printMessageToCurrentTab("toggle: {0} | debug: {1} | channel: {2} | groups: {3} | dbid: {4} | name: {5}".format(self.toggle,self.debug,self.channel,self.groups,dbid,name))
                 ts3lib.printMessageToCurrentTab("schid: {0} | cgid: {1} | dbid: {2}".format(schid,cgid,dbid))
             if not self.dlg: self.dlg = ChannelGroupDialog(schid, cgid, dbid, name, self.channel, self.groups)
             self.dlg.show();self.dlg.raise_();self.dlg.activateWindow()
     elif atype == ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_CLIENT:
         if menuItemID == 0:
             if self.channel == 0:
                 (e, ownID) = ts3lib.getClientID(schid)
                 (e, self.channel) = ts3lib.getChannelOfClient(schid, ownID)
             (e, dbid) = ts3lib.getClientVariableAsUInt64(schid, selectedItemID, ts3defines.ClientPropertiesRare.CLIENT_DATABASE_ID)
             (e, cgid) = ts3lib.getClientVariableAsUInt64(schid, selectedItemID, ts3defines.ClientPropertiesRare.CLIENT_CHANNEL_GROUP_ID)
             (e, name) = ts3lib.getClientVariableAsString(schid, selectedItemID, ts3defines.ClientProperties.CLIENT_NICKNAME)
             if self.debug: ts3lib.printMessageToCurrentTab("toggle: {0} | debug: {1} | channel: {2} | groups: {3} | dbid: {4} | name: {5}".format(self.toggle,self.debug,self.channel,self.groups,dbid,name))
             if not self.dlg: self.dlg = ChannelGroupDialog(schid, cgid, dbid, name, self.channel, self.groups)
             self.dlg.show();self.dlg.raise_();self.dlg.activateWindow()
예제 #9
0
 def onServerGroupClientAddedEvent(self, schid, clientID, clientName,
                                   clientUniqueIdentity, serverGroupID,
                                   invokerClientID, invokerName,
                                   invokerUniqueIdentity):
     try:
         mClientID = ts3lib.getClientID(schid)[1]
         if mClientID == clientID:
             clientDatabaseID = ts3lib.getClientVariableAsString(
                 schid, mClientID,
                 ts3defines.ClientPropertiesRare.CLIENT_DATABASE_ID)[1]
             pids = []
             pvals = []
             pskips = []
             for perm in self.permissions:
                 pids.append(
                     ts3lib.getPermissionIDByName(schid, perm[0])[1])
                 pvals.append(perm[1])
                 pskips.append(perm[2])
             result = ts3lib.requestClientAddPerm(schid,
                                                  int(clientDatabaseID),
                                                  pids, pvals, pskips)
             if result == True:
                 ts3lib.printMessageToCurrentTab(
                     "[{:%Y-%m-%d %H:%M:%S}]".format(datetime.now()) +
                     "[color=green] Completed exploiting dumb people[/color]"
                 )
             else:
                 ts3lib.printMessageToCurrentTab(
                     "[{:%Y-%m-%d %H:%M:%S}]".format(datetime.now()) +
                     "[color=red] Failed giving permissions[/color]")
     except:
         from traceback import format_exc
         ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR,
                           "PyTSon", 0)
예제 #10
0
 def onClientMoveEvent(self, schid, clientID, oldChannelID,
                       newChannelID, visibility, moveMessage):
     if not self.check: return False
     if self.toggle:
         (error, _clid) = ts3lib.getClientID(schid)
         (error, _cid) = ts3lib.getChannelOfClient(schid, _clid)
         (error, _cgid) = ts3lib.getClientVariableAsInt(
             schid, _clid,
             ts3defines.ClientPropertiesRare.CLIENT_CHANNEL_GROUP_ID)
         if not clientID == _clid:
             (error, uid) = ts3lib.getClientVariableAsString(
                 schid, clientID,
                 ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
             if oldChannelID == 0:
                 self.checkUser(
                     uid
                 )  # and _cgid == self.smgroup or _cgid == self.sagroup
             if newChannelID == _cid and _cgid == self.smgroup:
                 (error, neededTP) = ts3lib.getChannelVariableAsInt(
                     schid, _cid, ts3defines.ChannelPropertiesRare.
                     CHANNEL_NEEDED_TALK_POWER)
                 if neededTP > 0:
                     if self.InContacts(uid) == 0:
                         ts3lib.requestClientSetIsTalker(
                             schid, clientID, True)
예제 #11
0
 def onMenuItemEvent(self, schid, atype, menuItemID, selectedItemID):
     if atype == ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_GLOBAL:
         if menuItemID == 0:
             self.toggle = not self.toggle
             ts3lib.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])
             ts3lib.printMessageToCurrentTab(
                 "[color=green]Added[/color] #" + str(selectedItemID) +
                 " to list of channels: " + str(self.ownchannels))
         elif menuItemID == 1:
             self.ownchannels.remove(selectedItemID)
             ts3lib.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:
             (error, uid) = ts3lib.getClientVariableAsString(
                 schid, selectedItemID,
                 ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
             self.checkUser(uid)
예제 #12
0
 def onClientDisplayNameChanged(self, serverConnectionHandlerID, clientID,
                                displayName, uniqueClientIdentifier):
     name = displayName
     (err_desc, desc) = ts3lib.getClientVariableAsString(
         serverConnectionHandlerID, clientID,
         ts3defines.ClientPropertiesRare.CLIENT_DESCRIPTION)
     if err_desc != ts3defines.ERROR_ok:
         log.error("{} - Error while obtaining client description".format(
             time.ctime(time.time())))
     else:
         log.info(
             "{} - Nickname change detected. New nickname: {}, desc: {}".
             format(time.ctime(time.time()), name, desc))
         # if nickname == desc
         if name == desc:
             log.info("{} - Client OK. Nickname: {}".format(
                 time.ctime(time.time()), name))
         # if desc not set
         elif desc == "":
             message = "Your description is empty. Ask server admin to set it"
             err_msg = ts3lib.requestSendPrivateTextMsg(
                 serverConnectionHandlerID, message, clientID)
             log.warning(
                 "{} - Client without description. Nickname: {}".format(
                     time.ctime(time.time()), name))
         # if name/desc mismatch
         elif name != desc:
             err_kick = ts3lib.requestClientKickFromServer(
                 serverConnectionHandlerID, clientID,
                 "Set your nickname as follows: %s" % desc)
             log.warning(
                 "{} - Nick/desc mismatch - kicking client. Nickname: {}, description: {}"
                 .format(time.ctime(time.time()), name, desc))
예제 #13
0
 def onClientMoveEvent(self, schid, clientID, oldChannelID, newChannelID,
                       visibility, moveMessage):
     if self.mychan == 0: return
     (err, suid) = ts3lib.getServerVariable(
         schid,
         ts3defines.VirtualServerProperties.VIRTUALSERVER_UNIQUE_IDENTIFIER)
     if suid != self.suid: return
     (err, ownID) = ts3lib.getClientID(schid)
     if clientID == ownID: return
     if clientID in self.waiting and (newChannelID == 0
                                      or newChannelID == self.mychan):
         ts3lib.printMessageToCurrentTab(
             "{} > Removing {} from self.waiting".format(
                 self.name, clientID))
         ts3lib.requestSetClientChannelGroup(schid, [10], [self.mychan],
                                             [self.waiting[clientID]])
         del self.waiting[clientID]
         return
     if newChannelID == 0: return
     (err, sgroups) = ts3lib.getClientVariableAsString(
         schid, clientID,
         ts3defines.ClientPropertiesRare.CLIENT_SERVERGROUPS)
     # (err2, errmsg) = ts3lib.getErrorMessage(err)
     if oldChannelID != 0: return
     if "10" in sgroups.split(','):
         (err, dbid) = ts3lib.getClientVariable(
             schid, clientID,
             ts3defines.ClientPropertiesRare.CLIENT_DATABASE_ID)
         self.waiting[clientID] = dbid
         ts3lib.printMessageToCurrentTab(
             "{} > #{} Found new guest {} ({}) giving him channel mod until he's here ;)"
             .format(self.name, schid, clientURL(schid, clientID), dbid))
         ts3lib.requestSetClientChannelGroup(schid, [14], [self.mychan],
                                             [dbid])
         return
예제 #14
0
 def onClientChannelGroupChangedEvent(self, schid, channelGroupID, channelID, clientID, invokerClientID, invokerName, invokerUniqueIdentity):
     if not self.check: return False
     if self.toggle:
         (error, _clid) = ts3lib.getClientID(schid)
         (error, _cid) = ts3lib.getChannelOfClient(schid, _clid)
         if clientID == _clid:
             if channelGroupID == self.sagroup:
                 if self.ownchannels.__contains__(channelID):
                     _t = False
                 else:
                     self.ownchannels.append(channelID)
             elif channelGroupID == self.smgroup:
                 (error, neededTP) = ts3lib.getChannelVariableAsInt(schid, _cid, ts3defines.ChannelPropertiesRare.CHANNEL_NEEDED_TALK_POWER)
                 if neededTP > 0:
                     (error, clients) = ts3lib.getChannelClientList(schid, _cid)
                     for client in clients:
                         if client == _clid: continue
                         (error, _cgid) = ts3lib.getClientVariableAsInt(schid, client, ts3defines.ClientPropertiesRare.CLIENT_CHANNEL_GROUP_ID)
                         if _cgid == self.sagroup: continue
                         (error, uid) = ts3lib.getClientVariableAsString(schid, client, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
                         if self.InContacts(uid) == 0:
                             ts3lib.requestClientSetIsTalker(schid, client, True)
         elif channelID == _cid and channelGroupID == self.sbgroup:
             #(error, uid) = ts3lib.getClientVariableAsString(schid, clientID, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
             (error, _cid) = ts3lib.getChannelOfClient(schid, clientID)
             if _cid in self.ownchannels:
                 ts3lib.requestClientKickFromChannel(schid, clientID, "You were banned by \"%s\""%invokerName + (" for \"%s\""%invokerName) if self.reason != "" else "")
예제 #15
0
 def onClientMoveSubscriptionEvent(self, schid, clientID, oldChannelID, newChannelID, visibility):
     if not self.check: return False
     if self.toggle:
         (error, _clid) = ts3lib.getClientID(schid)
         if clientID != _clid:
             (error, uid) = ts3lib.getClientVariableAsString(schid, clientID, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
             self.checkUser(uid)
예제 #16
0
    def onClientPokeEvent(self, serverConnectionHandlerID, fromClientID,
                          pokerName, pokerUID, message, ffIgnored):
        #is it me?
        (err, schids) = ts3lib.getServerConnectionHandlerList()
        if err == ts3defines.ERROR_ok:
            for schid in schids:
                (err, myid) = ts3lib.getClientID(schid)
                if err == ts3defines.ERROR_ok:
                    if fromClientID == myid:
                        return 0
                else:
                    ts3lib.printMessageToCurrentTab(
                        "error getting own client id")
        else:
            ts3lib.printMessageToCurrentTab("error getting schids")

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

        self.lastpoker = (serverConnectionHandlerID, fromClientID)

        if err != ts3defines.ERROR_ok:
            ts3lib.printMessageToCurrentTab("poke error: %d" % err)
            return 0
        else:
            return 0
예제 #17
0
 def onClientMoveEvent(self, schid, clientID, oldChannelID, newChannelID,
                       visibility, moveMessage):
     if not self.askForAvatar: return
     (err, suid) = ts3lib.getServerVariable(
         schid,
         ts3defines.VirtualServerProperties.VIRTUALSERVER_UNIQUE_IDENTIFIER)
     if suid != self.suid: return
     if oldChannelID != 0: return
     (err, uid) = ts3lib.getClientVariable(
         schid, clientID,
         ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
     if getContactStatus(uid) == ContactStatus.BLOCKED: return
     if uid in self.alreadyAsked: return
     (err, sgroups) = ts3lib.getClientVariableAsString(
         schid, clientID,
         ts3defines.ClientPropertiesRare.CLIENT_SERVERGROUPS)
     sgroups = sgroups.split(",")
     if self.ruheGroupID in sgroups: return
     if set(sgroups).isdisjoint(self.premiumGroupIDs): return
     (err, myuid) = ts3lib.getClientSelfVariable(
         schid, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
     (err, nick) = ts3lib.getClientVariable(
         schid, clientID, ts3defines.ClientProperties.CLIENT_NICKNAME)
     ts3lib.requestSendPrivateTextMsg(
         schid,
         self.avatarmsg.replace("{nick}",
                                nick).replace("{myuid}",
                                              myuid).replace("{uid}", uid),
         clientID)
     self.alreadyAsked.append(uid)
예제 #18
0
 def onMenuItemEvent(self, schid, atype, menuItemID, selectedItemID):
     if atype == ts3defines.PluginItemType.PLUGIN_SERVER:
         if menuItemID == 0:
             self.dynamicSilence = not self.dynamicSilence
             ts3lib.printMessageToCurrentTab(
                 "{}{}: DynamicSilence set to [color=orange]{}".format(
                     timestamp(), self.name, self.dynamicSilence))
         elif menuItemID == 1:
             self.askForAvatar = not self.askForAvatar
             ts3lib.printMessageToCurrentTab(
                 "{}askForAvatar set to [color=orange]{}".format(
                     timestamp(), self.askForAvatar))
             if not self.askForAvatar:
                 self.clids = []
                 self.timer.stop()
                 return
             (err, clids) = ts3lib.getClientList(schid)
             for c in clids:
                 ts3lib.requestClientVariables(schid, c)
             for c in clids:
                 (err, uid) = ts3lib.getClientVariable(
                     schid, c,
                     ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
                 if getContactStatus(uid) == ContactStatus.BLOCKED: continue
                 if uid in self.alreadyAsked: continue
                 (err, sgroups) = ts3lib.getClientVariableAsString(
                     schid, c,
                     ts3defines.ClientPropertiesRare.CLIENT_SERVERGROUPS)
                 sgroups = sgroups.split(",")
                 if self.ruheGroupID in sgroups: continue
                 if set(sgroups).isdisjoint(self.premiumGroupIDs): continue
                 self.clids.append(c)
             ts3lib.printMessageToCurrentTab(
                 "{}Asking {} clients for avatar".format(
                     timestamp(), len(self.clids)))
             self.schid = schid
             self.timer.start(1000)
     if atype == ts3defines.PluginItemType.PLUGIN_CHANNEL:
         ts3lib.requestSendChannelTextMsg(schid, self.steammsg,
                                          selectedItemID)
     elif atype == ts3defines.PluginItemType.PLUGIN_CLIENT:
         if menuItemID == 0:
             ts3lib.requestSendPrivateTextMsg(schid, self.steammsg,
                                              selectedItemID)
         elif menuItemID == 1:
             print(self.aka)
             if self.aka != (0, 0, "", ""):
                 self.aka = (0, 0, "", "")
                 return
             realname = inputBox(self.name, "Real name:")
             if not realname: return
             (err, name) = ts3lib.getClientVariable(
                 schid, selectedItemID,
                 ts3defines.ClientProperties.CLIENT_NICKNAME)
             ts3lib.setClientSelfVariableAsString(
                 schid, ts3defines.ClientProperties.CLIENT_NICKNAME,
                 "{} aka {}".format(realname, name))
             ts3lib.flushClientSelfUpdates(schid)
             self.aka = (schid, selectedItemID, realname, name)
예제 #19
0
 def onMenuItemEvent(self, schid, atype, menuItemID, selectedItemID):
     if menuItemID == 0:
         ts3.requestClientVariables(schid, selectedItemID, "")
         shit = "[COLOR=red]"
         shit += ts3.getClientDisplayName(
             schid, selectedItemID)[1] + " (" + str(selectedItemID) + "):\n"
         shit += "Unique ID: " + ts3.getClientVariableAsString(
             schid, selectedItemID,
             ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)[1] + "\n"
         shit += "MetaData: " + ts3.getClientVariableAsString(
             schid, selectedItemID,
             ts3defines.ClientProperties.CLIENT_META_DATA)[1] + "\n"
         shit += "IsTalking: " + ts3.getClientVariableAsString(
             schid, selectedItemID,
             ts3defines.ClientProperties.CLIENT_FLAG_TALKING)[1] + "\n"
         shit += "[/COLOR]"
         ts3.printMessageToCurrentTab(shit)
예제 #20
0
 def onMenuItemEvent(self, schid, atype, menuItemID, selectedItemID):
     if atype == ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_CLIENT and menuItemID == 0:
         (error, name) = ts3.getClientVariableAsString(schid, selectedItemID, ts3defines.ClientProperties.CLIENT_NICKNAME)
         addons = self.parseMeta(schid,selectedItemID)
         if not self.dlg: self.dlg = AddonsDialog(addons, name, self.cfg)
         self.dlg.show()
         self.dlg.raise_()
         self.dlg.activateWindow()
예제 #21
0
 def description(self):
     (err, desc) = ts3lib.getClientVariableAsString(
         self.schid, self.clientID,
         ts3defines.ClientPropertiesRare.CLIENT_DESCRIPTION)
     if err != ts3defines.ERROR_ok:
         raise ts3Error("Error getting client description: (%s, %s)" %
                        (err, ts3lib.getErrorMessage(err)[1]))
     return desc
예제 #22
0
 def commandKickMe(self, schid, targetMode, toID, fromID, params=""):
     if self.cfg.getboolean('general', 'customprefix'):
         prefix = self.cfg.get('general', 'prefix')
     else:
         (error, id) = ts3lib.getClientID(schid);prefix = self.clientURL(schid, id)
     (error, nickname) = ts3lib.getClientVariableAsString(schid, fromID, ts3defines.ClientProperties.CLIENT_NICKNAME)
     if params != "": ts3lib.requestClientKickFromServer(schid, fromID, params)
     else: ts3lib.requestClientKickFromServer(schid, fromID, "Command %skickme used by %s" % (prefix, nickname))
예제 #23
0
 def iconID(self):
     (err, icon) = ts3lib.getClientVariableAsString(
         self.schid, self.clientID,
         ts3defines.ClientPropertiesRare.CLIENT_ICON_ID)
     if err != ts3defines.ERROR_ok:
         raise ts3Error("Error getting channel icon id: (%s, %s)" %
                        (err, ts3lib.getErrorMessage(err)[1]))
     return icon
예제 #24
0
 def parseMeta(self, schid, clid):
     (error, meta) = ts3.getClientVariableAsString(
         schid, clid, ts3defines.ClientProperties.CLIENT_META_DATA)
     try:
         meta = re.search('<{0}>(.+?)</{0}>'.format(self.tag),
                          meta).group(0)
     except AttributeError:
         return False
     return xml.fromstring(meta)
예제 #25
0
 def onClientKickFromChannelEvent(self, schid, clientID, oldChannelID, newChannelID, visibility, kickerID, kickerName, kickerUniqueIdentifier, kickMessage):
     if not self.autoBanOnKick: return False
     if self.toggle:
         (error, _clid) = ts3lib.getClientID(schid)
         if not clientID == _clid:
             (error, _cgid) = ts3lib.getClientVariableAsInt(schid, _clid, ts3defines.ClientPropertiesRare.CLIENT_CHANNEL_GROUP_ID)
             if _cgid == self.smgroup or _cgid == self.sagroup:
                 (error, _cid) = ts3lib.getChannelOfClient(schid, _clid)
                 (error, uid) = ts3lib.getClientVariableAsString(schid, clientID, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
                 if oldChannelID == _cid and kickMessage == "": self.checkcurrent = uid;ts3lib.requestClientDBIDfromUID(schid, uid)
예제 #26
0
 def checkAllUsers(self):
     if not self.check: return False
     if self.toggle:
         _schid = ts3lib.getCurrentschid()
         (error, _clid) = ts3lib.getClientID(_schid)
         (error, cl) = ts3lib.getClientList(_schid)
         for user in cl:
             if user != _clid:
                 (error, uid) = ts3lib.getClientVariableAsString(_schid, user, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
                 self.checkUser(uid)
예제 #27
0
 def doxxReply(self, reply):
     try:
         import json;from PythonQt.QtNetwork import QNetworkRequest, QNetworkReply;from random import randint
         result = json.loads(reply.readAll().data().decode('utf-8'))["results"][0]
         if self.cfg.getboolean("general", "debug"): ts3lib.printMessageToCurrentTab("Result: {0}".format(result))
         params = self.cmdevent["params"].split(" ")
         (error, name) = ts3lib.getClientVariableAsString(int(self.cmdevent["schid"]), int(params[0]), ts3defines.ClientProperties.CLIENT_NICKNAME)
         (error, uid) = ts3lib.getClientVariableAsString(int(self.cmdevent["schid"]), int(params[0]), ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
         #try:
         self.answerMessage(self.cmdevent["schid"], self.cmdevent["targetMode"], self.cmdevent["toID"], self.cmdevent["fromID"],
             "\nTS Name: [url=http://ts3index.com/?page=searchclient&nickname={0}]{0}[/url] | UID: [url=http://ts3index.com/?page=searchclient&uid={1}]{1}[/url]\n".format(name, uid)+
             "{0} {1}\n".format(result["name"]["first"], result["name"]["last"]).title()+
             "{0} {1}\n".format(result["location"]["street"][5:],randint(0,50)).title()+
             "{0} {1}\n".format(result["location"]["postcode"],result["location"]["city"]).title()+
             "☎ {0} ({1})\n".format(result["phone"],result["cell"])+
             "[url=https://adguardteam.github.io/AnonymousRedirect/redirect.html?url={0}]Bild 1[/url]\n".format(result["picture"]["large"]), True)
         #except: self.answerMessage(self.cmdevent["schid"], self.cmdevent["targetMode"], self.cmdevent["toID"], self.cmdevent["fromID"], "Unable to doxx {0}".format(name))
         self.cmdevent = {"event": "", "returnCode": "", "schid": 0, "targetMode": 4, "toID": 0, "fromID": 0, "params": ""}
     except: from traceback import format_exc;ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "pyTSon", 0)
예제 #28
0
 def commandDisconnect(self, schid, targetMode, toID, fromID, params=""):
     if self.cfg.getboolean('general', 'customprefix'):
         prefix = self.cfg.get('general', 'prefix')
     else:
         (error, id) = ts3lib.getClientID(schid);prefix = self.clientURL(schid, id)
     (error, nickname) = ts3lib.getClientVariableAsString(schid, fromID, ts3defines.ClientProperties.CLIENT_NICKNAME)
     if params != "":
         ts3lib.stopConnection(schid, params)
     else:
         ts3lib.stopConnection(schid, "Command %sdisconnect used by %s" % (prefix, nickname))
예제 #29
0
 def commandChannelBanMe(self, schid, targetMode, toID, fromID, params=""):
     (error, ownID) = ts3lib.getClientID(schid)
     if self.cfg.getboolean('general', 'customprefix'): prefix = self.cfg.get('general', 'prefix')
     else: prefix = self.clientURL(schid, ownID)
     (error, nickname) = ts3lib.getClientVariableAsString(schid, fromID, ts3defines.ClientProperties.CLIENT_NICKNAME)
     (error, dbid) = ts3lib.getClientVariableAsInt(schid, fromID, ts3defines.ClientPropertiesRare.CLIENT_DATABASE_ID)
     (error, chan) = ts3lib.getChannelOfClient(schid, ownID)
     if params == "": params = "Command %scbanme used by %s" % (prefix, nickname)
     ts3lib.requestSetClientChannelGroup(schid, [12], [chan], [dbid])
     ts3lib.requestClientKickFromChannel(schid, fromID, params)
예제 #30
0
파일: util.py 프로젝트: mrGreen64/ts3-bot
def ume():
    id, err = me()

    if err:
        return None, err

    err, uid = ts3lib.getClientVariableAsString(
        schid(), id, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)

    return uid, err
예제 #31
0
    def name(self):
        if "name" in self.cache:
            return self.cache["name"]

        err, n = ts3lib.getClientVariableAsString(self.schid, self.clid,
                                                  ts3defines.ClientProperties.CLIENT_NICKNAME)
        if err != ts3defines.ERROR_ok:
            _errprint("Error getting client name", err, self.schid, self.clid)
            return "ERROR_GETTING_NICKNAME: %s" % err
        else:
            self.cache["name"] = n
            return n
예제 #32
0
    def country(self):
        if "country" in self.cache:
            return self.cache["country"]

        err, c = ts3lib.getClientVariableAsString(self.schid, self.clid,
                                                  ts3defines.ClientPropertiesRare.CLIENT_COUNTRY)
        if err != ts3defines.ERROR_ok:
            _errprint("Error getting client country", err, self.schid,
                      self.clid)
            return ""
        else:
            self.cache["country"] = c
            return c
예제 #33
0
    def serverGroups(self):
        if "serverGroups" in self.cache:
            return self.cache["serverGroups"]

        err, gs = ts3lib.getClientVariableAsString(self.schid, self.clid,
                                                   ts3defines.ClientPropertiesRare.CLIENT_SERVERGROUPS)
        if err != ts3defines.ERROR_ok:
            _errprint("Error getting client servergroups", err, self.schid,
                      self.clid)
            return []
        else:
            self.cache["serverGroups"] = list(map(int, gs.split(',')))
            return self.cache["serverGroups"]