コード例 #1
0
ファイル: __init__.py プロジェクト: quorraa/pyTSon_plugins
 def onConnectStatusChangeEvent(self, schid, newStatus, errorNumber):
     if not self.enabled: return
     if newStatus != ts3defines.ConnectStatus.STATUS_CONNECTING: return
     if self.proxied: self.proxied = False; return
     err, host, port, pw = ts3lib.getServerConnectInfo(schid)
     if host.lower() in self.whitelist: ts3lib.printMessageToCurrentTab("[color=green]%s is whitelisted, not using proxy!" % host); return
     ip = QHostAddress(host)
     if not ip.isNull():
         if ip.isLoopback(): ts3lib.printMessageToCurrentTab("[color=green]%s is Loopback, not using proxy!" % host); return
         elif ip.isMulticast(): ts3lib.printMessageToCurrentTab("[color=green]%s is Multicast, not using proxy!" % host); return
     is_nickname = False
     if not "." in host:
         ts3lib.printMessageToCurrentTab("[color=orange]%s is a server nickname, resolving..." % host)
         self.backup["address"] = host
         is_nickname = True
     if not is_nickname:
         self.backup["address"] = "{}:{}".format(host,port)
         ts3lib.printMessageToCurrentTab("[color=red]Not proxied on %s, disconnecting!"%self.backup["address"])
     ts3lib.stopConnection(schid, "switching to proxy")
     if pw: self.backup["pw"] = pw
     err, nickname = ts3lib.getClientSelfVariable(schid, ts3defines.ClientProperties.CLIENT_NICKNAME)
     if not err and nickname: self.backup["nickname"] = nickname
     err, nickname_phonetic = ts3lib.getClientSelfVariable(schid, ts3defines.ClientPropertiesRare.CLIENT_NICKNAME_PHONETIC)
     if not err and nickname_phonetic: self.backup["phonetic"] = nickname_phonetic
     err, c = ts3lib.getClientSelfVariable(schid, ts3defines.ClientProperties.CLIENT_DEFAULT_CHANNEL)
     if not err and c: self.backup["c"] = c
     err, cpw = ts3lib.getClientSelfVariable(schid, ts3defines.ClientProperties.CLIENT_DEFAULT_CHANNEL_PASSWORD)
     if not err and cpw: self.backup["cpw"] = cpw
     err, default_token = ts3lib.getClientSelfVariable(schid, ts3defines.ClientPropertiesRare.CLIENT_DEFAULT_TOKEN)
     if not err and default_token: self.backup["token"] = default_token
     if is_nickname:
         self.nwmc_resolver.get(QNetworkRequest(QUrl("https://named.myteamspeak.com/lookup?name=%s"%host)))
         return
     self.proxy(host, port)
コード例 #2
0
ファイル: __init__.py プロジェクト: barti6661/pyTSon_plugins
 def checkServer(self, schid=None):
     if not schid: schid = self.schid
     (err, servername) = ts3lib.getServerVariable(schid, ts3defines.VirtualServerProperties.VIRTUALSERVER_NAME)
     (err, ownuid) = ts3lib.getClientSelfVariable(schid, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
     if PluginHost.cfg.getboolean("general", "verbose"):
         ts3lib.printMessageToCurrentTab(self.name+"> Checking for channel....")
         print("servername:", servername, "cfg:",self.cfg.get("general","servername"), servername == self.cfg.get("general","servername"))
         print("myuid",ownuid,self.cfg.get("general","myuid"), ownuid == self.cfg.get("general","myuid"))
     if servername != self.cfg.get("general","servername"): return
     if ownuid != self.cfg.get("general","myuid"): return
     print("mein test 1")
     content = StringIO("[general]\nmychan = ╠-● Administrator | Blu")

     cfg = ConfigParser()

     cfg.readfp(content)
     
print(cfg.get("general", "mychan")
)
     print(type(cfg.get("general", "mychan"))
)
     print(cfg.get("general", "mychan").split(",")
)
     return
     # mychan = StringIO("╠-● Administrator | Blu").split(",")
     # mychan = self.cfg.get("general", "mychan") # .split(",")
     print(mychan)
     mycid = ts3lib.getChannelIDFromChannelNames(schid, mychan)
     print("mein test 2")
     self.schids.append({schid: mycid})
     print("mein test 3")
     self.toggleChannel(schid)
コード例 #3
0
ファイル: __init__.py プロジェクト: sancakbeyy/pyTSon_plugins
 def onConnectStatusChangeEvent(self, schid, newStatus, errorNumber):
     if newStatus != ts3defines.ConnectStatus.STATUS_CONNECTION_ESTABLISHED: return
     (err, suid) = ts3lib.getServerVariable(schid, ts3defines.VirtualServerProperties.VIRTUALSERVER_UNIQUE_IDENTIFIER)
     if suid != self.suid: return
     (err, uid) = ts3lib.getClientSelfVariable(schid, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
     self.requested = uid
     ts3lib.requestClientDBIDfromUID(schid, uid)
コード例 #4
0
 def onConnectStatusChangeEvent(self, schid, newStatus, errorNumber):
     if newStatus != ts3defines.ConnectStatus.STATUS_CONNECTION_ESTABLISHED:
         return
     if not self.nick_enabled: return
     (err, suid) = ts3lib.getServerVariable(
         schid,
         ts3defines.VirtualServerProperties.VIRTUALSERVER_UNIQUE_IDENTIFIER)
     if suid != self.suid: return
     (err, name) = ts3lib.getClientSelfVariable(
         schid, ts3defines.ClientProperties.CLIENT_NICKNAME)
     _name = choice(self.nicknames)
     if "{" in _name:
         (err, ownID) = ts3lib.getClientID(schid)
         if "{ver}" in _name:
             (err, ver) = ts3lib.getClientVariable(
                 schid, ownID, ts3defines.ClientProperties.CLIENT_VERSION)
             _name = _name.replace("{ver}", ver.split(" ")[0])
         if "{os}" in _name:
             (err, os) = ts3lib.getClientVariable(
                 schid, ownID, ts3defines.ClientProperties.CLIENT_PLATFORM)
             _name = _name.replace("{os}", os)
         if "{con}" in _name:
             # ts3lib.requestClientVariables(schid, ownID)
             (err, os) = ts3lib.getClientVariable(
                 schid, ownID,
                 ts3defines.ClientPropertiesRare.CLIENT_TOTALCONNECTIONS)
             _name = _name.replace("{con}", str(os))
     if _name == name: return
     ts3lib.setClientSelfVariableAsString(
         schid, ts3defines.ClientProperties.CLIENT_NICKNAME, _name)
     ts3lib.flushClientSelfUpdates(schid)
コード例 #5
0
ファイル: __init__.py プロジェクト: alex720/pyTSon_plugins
 def onMenuItemEvent(self, schid, atype, menuItemID, selectedItemID):
     if menuItemID == 0:
         if self.timer is None:
             self.timer = QTimer()
             self.timer.timeout.connect(self.tick)
         if self.timer.isActive():
             self.timer.stop()
             self.timer = None
             ts3lib.setClientSelfVariableAsString(
                 schid, ts3defines.ClientProperties.CLIENT_NICKNAME,
                 self.nick)
             ts3lib.flushClientSelfUpdates(schid)
             ts3lib.printMessageToCurrentTab('Timer stopped!')
         else:
             (err, nick) = ts3lib.getClientSelfVariable(
                 schid, ts3defines.ClientProperties.CLIENT_NICKNAME)
             if len(nick) > self.max - 2:
                 errorMsgBox(
                     "Error",
                     "Nickname must be %s chars or below!" % self.max)
                 return
             self.nick = nick
             self._nick = list(nick)
             self.i = self.max - 2
             self.b = 0
             self.schid = schid
             step = inputBox(self.name, 'Interval in Milliseconds:')
             if step: interval = int(step)
             else: interval = 300
             self.timer.start(interval)
             ts3lib.printMessageToCurrentTab('Timer started!')
コード例 #6
0
ファイル: __init__.py プロジェクト: sancakbeyy/pyTSon_plugins
 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)
コード例 #7
0
 def tick(self):
     if not self.askForAvatar or not self.schid or len(self.clids) < 1: self.timer.stop(); return
     (err, myuid) = ts3lib.getClientSelfVariable(self.schid, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
     (err, uid) = ts3lib.getClientVariable(self.schid, self.clids[0], ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
     (err, nick) = ts3lib.getClientVariable(self.schid, self.clids[0], ts3defines.ClientProperties.CLIENT_NICKNAME)
     ts3lib.requestSendPrivateTextMsg(self.schid, self.avatarmsg.replace("{nick}", nick).replace("{myuid}", myuid).replace("{uid}", uid), self.clids[0])
     self.alreadyAsked.append(uid)
     del self.clids[0]
コード例 #8
0
 def updateVoice(self, schid, status=None):
     curschid = ts3lib.getCurrentServerConnectionHandlerID()
     if schid != curschid: return
     if not status:
         (err, status) = ts3lib.getClientSelfVariable(
             schid, ts3defines.ClientProperties.CLIENT_FLAG_TALKING)
     (err, afk) = ts3lib.getClientSelfVariable(
         schid, ts3defines.ClientPropertiesRare.CLIENT_AWAY)
     (err, output_activated) = ts3lib.getClientSelfVariable(
         schid, ts3defines.ClientProperties.CLIENT_OUTPUT_HARDWARE)
     (err, output_muted) = ts3lib.getClientSelfVariable(
         schid, ts3defines.ClientProperties.CLIENT_OUTPUT_MUTED)
     (err, input_activated) = ts3lib.getClientSelfVariable(
         schid, ts3defines.ClientProperties.CLIENT_INPUT_HARDWARE)
     (err, input_muted) = ts3lib.getClientSelfVariable(
         schid, ts3defines.ClientProperties.CLIENT_INPUT_MUTED)
     (err, commander) = ts3lib.getClientSelfVariable(
         schid, ts3defines.ClientPropertiesRare.CLIENT_IS_CHANNEL_COMMANDER)
     if PluginHost.cfg.getboolean("general", "verbose"):
         print("CLIENT_AWAY", afk, "CLIENT_OUTPUT_HARDWARE",
               output_activated, "CLIENT_OUTPUT_MUTED", output_muted,
               "CLIENT_INPUT_HARDWARE", input_activated,
               "CLIENT_INPUT_MUTED", input_muted)
     if afk:
         self.activity["assets"]["small_text"] = "Away From Keyboard"
         self.activity["assets"]["small_image"] = "away"
         self.update = True
     elif not output_activated:
         self.activity["assets"]["small_text"] = "Output Deactivated"
         self.activity["assets"]["small_image"] = "hardware_output_muted"
         self.update = True
     elif output_muted:
         self.activity["assets"]["small_text"] = "Output Muted"
         self.activity["assets"]["small_image"] = "output_muted"
         self.update = True
     elif not input_activated:
         self.activity["assets"]["small_text"] = "Input Deactivated"
         self.activity["assets"]["small_image"] = "hardware_input_muted"
         self.update = True
     elif input_muted:
         self.activity["assets"]["small_text"] = "Input Muted"
         self.activity["assets"]["small_image"] = "input_muted"
         self.update = True
     elif status and commander:
         self.activity["assets"][
             "small_text"] = "Talking with Channel Commander"
         self.activity["assets"]["small_image"] = "player_commander_on"
         self.update = True
     elif status and not commander:
         self.activity["assets"]["small_text"] = "Talking"
         self.activity["assets"]["small_image"] = "player_on"
         self.update = True
     elif not status and commander:
         self.activity["assets"]["small_text"] = "Silent"
         self.activity["assets"]["small_image"] = "player_commander_off"
         self.update = True
     elif not status and not commander:
         self.activity["assets"]["small_text"] = "Silent"
         self.activity["assets"]["small_image"] = "player_off"
         self.update = True
コード例 #9
0
 def tick(self):
     (err, commander) = ts3lib.getClientSelfVariable(
         self.schid,
         ts3defines.ClientPropertiesRare.CLIENT_IS_CHANNEL_COMMANDER)
     ts3lib.setClientSelfVariableAsInt(
         self.schid,
         ts3lib.ClientPropertiesRare.CLIENT_IS_CHANNEL_COMMANDER,
         not commander)
     ts3lib.flushClientSelfUpdates(self.schid, self.retcode)
コード例 #10
0
 def onTalkStatusChangeEvent(self, schid, status, isReceivedWhisper, clid):
     if not self.mode == autoCommanderMode.START_TALKING: return
     (err, ownID) = ts3lib.getClientID(schid)
     if ownID != clid: return
     (err, commander) = ts3lib.getClientSelfVariable(
         schid, ts3defines.ClientPropertiesRare.CLIENT_IS_CHANNEL_COMMANDER)
     if status == ts3defines.TalkStatus.STATUS_TALKING and not commander:
         self.setChannelCommander(schid, True)
     elif status == ts3defines.TalkStatus.STATUS_NOT_TALKING and commander:
         self.setChannelCommander(schid, False)
コード例 #11
0
 def onClientMoveEvent(self, schid, clientID, oldChannelID, newChannelID, visibility, moveMessage):
     if schid != self.schid: return
     (err, ownID) = ts3lib.getClientID(schid)
     if clientID != ownID: return
     if not self.request_tp: return
     self.request_tp = False
     (err, needed_tp) = ts3lib.getChannelVariable(schid, newChannelID, ts3defines.ChannelPropertiesRare.CHANNEL_NEEDED_TALK_POWER)
     if needed_tp >=0:
         (err, ownTP) = ts3lib.getClientSelfVariable(schid, ts3defines.ClientPropertiesRare.CLIENT_TALK_POWER)
         if int(ownTP) < needed_tp: ts3lib.requestIsTalker(schid, True, "")
コード例 #12
0
ファイル: __init__.py プロジェクト: sancakbeyy/pyTSon_plugins
 def __init__(self):
     schid = ts3lib.getCurrentServerConnectionHandlerID()
     err, clid = ts3lib.getClientID(schid)
     err, cid = ts3lib.getChannelOfClient(schid, clid)
     (err, cgid) = ts3lib.getClientSelfVariable(
         schid, ts3defines.ClientPropertiesRare.CLIENT_CHANNEL_GROUP_ID)
     if cgid == 9: self.mychan = cid
     if PluginHost.cfg.getboolean("general", "verbose"):
         ts3lib.printMessageToCurrentTab(
             "{0}[color=orange]{1}[/color] Plugin for pyTSon by [url=https://github.com/{2}]{2}[/url] loaded."
             .format(timestamp(), self.name, self.author))
コード例 #13
0
 def onConnectStatusChangeEvent(self, schid, newStatus, errorNumber):
     try:
         if newStatus == ts3defines.ConnectStatus.STATUS_CONNECTION_ESTABLISHED:
             err, mic = ts3.getClientSelfVariable(
                 schid, ts3defines.ClientProperties.CLIENT_INPUT_HARDWARE)
             if not err and not mic: self.setStatus(schid)
     except:
         from traceback import format_exc
         ts3.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR,
                        "pyTSon", 0)
         pass
コード例 #14
0
ファイル: __init__.py プロジェクト: sancakbeyy/pyTSon_plugins
 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.getClientList(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
コード例 #15
0
 def onClientMoveEvent(self, schid, clientID, oldChannelID, newChannelID,
                       visibility, moveMessage):
     (err, ownID) = ts3lib.getClientID(schid)
     if clientID != ownID: return
     (err, needed_tp) = ts3lib.getChannelVariable(
         schid, newChannelID,
         ts3defines.ChannelPropertiesRare.CHANNEL_NEEDED_TALK_POWER)
     if needed_tp >= 0:
         # (err, hasTP) = ts3lib.getClientSelfVariable(schid, ts3defines.ClientPropertiesRare.CLIENT_IS_TALKER)
         (err, ownTP) = ts3lib.getClientSelfVariable(
             schid, ts3defines.ClientPropertiesRare.CLIENT_TALK_POWER)
         if int(ownTP) < needed_tp:
             ts3lib.requestSendPrivateTextMsg(
                 schid, self.text, self.servers[schid]["clid"],
                 self.retcode)  # ts3lib.requestIsTalker(schid, True, "")
コード例 #16
0
ファイル: __init__.py プロジェクト: sancakbeyy/pyTSon_plugins
 def onConnectStatusChangeEvent(self, schid, newStatus, errorNumber):
     if newStatus != ts3defines.ConnectStatus.STATUS_CONNECTION_ESTABLISHED:
         return
     if not self.nick_enabled: return
     (err, suid) = ts3lib.getServerVariable(
         schid,
         ts3defines.VirtualServerProperties.VIRTUALSERVER_UNIQUE_IDENTIFIER)
     if suid != self.suid: return
     (err, name) = ts3lib.getClientSelfVariable(
         schid, ts3defines.ClientProperties.CLIENT_NICKNAME)
     _name = choice(self.nicknames)
     if _name == name: return
     ts3lib.setClientSelfVariableAsString(
         schid, ts3defines.ClientProperties.CLIENT_NICKNAME, _name)
     ts3lib.flushClientSelfUpdates(schid)
コード例 #17
0
 def checkServer(self, schid=None):
     if not schid: schid = self.schid
     (err, suid) = ts3lib.getServerVariable(
         schid,
         ts3defines.VirtualServerProperties.VIRTUALSERVER_UNIQUE_IDENTIFIER)
     (err, ownuid) = ts3lib.getClientSelfVariable(
         schid, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
     if PluginHost.cfg.getboolean("general", "verbose"):
         ts3lib.printMessageToCurrentTab(self.name +
                                         "> Checking for channel....")
         print("suid:", suid, self.cfg.get("general", "suid"))
         print("myuid", ownuid, self.cfg.get("general", "myuid"))
     if suid != self.cfg.get("general", "suid"): return
     if ownuid != self.cfg.get("general", "myuid"): return
     self.toggleChannel(schid)
     self.schids.append(schid)
コード例 #18
0
 def onConnectStatusChangeEvent(self, schid, status, errorNumber):
     if status != ts3defines.ConnectStatus.STATUS_CONNECTION_ESTABLISHED: return
     (err, mynick) = ts3lib.getClientSelfVariable(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) = ts3lib.getClientList(schid)
         if err != ts3defines.ERROR_ok: return
         for cli in clis:
             (err, nick) = ts3lib.getClientVariable(schid, cli, ts3defines.ClientProperties.CLIENT_NICKNAME)
             if err == ts3defines.ERROR_ok and nick == sp[0]:
                 err = ts3lib.requestClientKickFromServer(schid, cli, "Client not responding")
                 self.schid = schid; self.newnick = sp[0]
                 ts3lib.printMessageToCurrentTab('err: {0}'.format(err))
                 if err == ts3defines.ERROR_ok: self.rename()
                 else: QTimer.singleShot(30000, self.rename)
コード例 #19
0
ファイル: __init__.py プロジェクト: pogolek/pyTSon_plugins
 def checkServer(self, schid=None):
     if not schid: schid = self.schid
     (err, servername) = ts3lib.getServerVariable(schid, ts3defines.VirtualServerProperties.VIRTUALSERVER_NAME)
     (err, ownuid) = ts3lib.getClientSelfVariable(schid, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
     if PluginHost.cfg.getboolean("general", "verbose"):
         ts3lib.printMessageToCurrentTab(self.name+"> Checking for channel....")
         print("servername:", servername, "cfg:",self.cfg.get("general","servername"), servername == self.cfg.get("general","servername"))
         print("myuid",ownuid,self.cfg.get("general","myuid"), ownuid == self.cfg.get("general","myuid"))
     if servername != self.cfg.get("general","servername"): return
     if ownuid != self.cfg.get("general","myuid"): return
     print("test1")
     mychan = self.cfg.get("general", "mychan") # .split(",")
     return
     mycid = ts3lib.getChannelIDFromChannelNames(schid, mychan)
     print("test3")
     self.schids.append({schid: mycid})
     print("test4")
     self.toggleChannel(schid)
コード例 #20
0
ファイル: __init__.py プロジェクト: sancakbeyy/pyTSon_plugins
 def onNewChannelCreatedEvent(self, schid, cid, channelParentID, invokerID,
                              invokerName, invokerUniqueIdentifier):
     if schid != self.schid:
         print(cid, "schid != self.schid")
         return
     (err, ownID) = ts3lib.getClientID(schid)
     if invokerID == ownID:
         print(cid, "invokerID == ownID")
         return
     if isPermanent(schid, cid) or isSemiPermanent(schid, cid):
         print("isPermanent(schid, cid) or isSemiPermanent(schid, cid)")
         return
     (error, maxclients) = ts3lib.getChannelVariable(
         schid, cid, ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS)
     # (error, maxfamilyclients) = ts3lib.getChannelVariable(schid, cid, ts3defines.ChannelProperties.CHANNEL_MAXFAMILYCLIENTS)
     if maxclients != -1:
         clients = channelClientCount(schid, cid)
         if clients >= maxclients:
             print(cid, "clients >= maxclients")
             return
     (err, needed_tp) = ts3lib.getChannelVariable(
         schid, cid,
         ts3defines.ChannelPropertiesRare.CHANNEL_NEEDED_TALK_POWER)
     if needed_tp >= 0:
         (err, ownTP) = ts3lib.getClientSelfVariable(
             schid, ts3defines.ClientPropertiesRare.CLIENT_TALK_POWER)
         if int(ownTP) < needed_tp: self.request_tp = True
     (err, pw) = ts3lib.getChannelVariable(
         schid, cid, ts3defines.ChannelProperties.CHANNEL_FLAG_PASSWORD)
     if err == ts3defines.ERROR_ok and pw:
         pw = getChannelPassword(schid, cid, False, False, True)
         # ts3lib.verifyChannelPassword(schid, cid, pw, "passwordCracker:manual")
         if not pw:
             print(cid, "not pw")
             return
     status = getContactStatus(invokerUniqueIdentifier)
     if status == ContactStatus.BLOCKED:
         print(cid, invokerUniqueIdentifier, "blocked")
         return
     ts3lib.printMessage(
         schid, "{} > Joining into {}".format(self.name,
                                              channelURL(schid, cid)),
         ts3defines.PluginMessageTarget.PLUGIN_MESSAGE_TARGET_SERVER)
     ts3lib.requestClientMove(schid, ownID, cid, pw if pw else "123")
コード例 #21
0
 def onConnectStatusChangeEvent(self, schid, status, errorNumber):
     if status == ConnectStatus.STATUS_CONNECTION_ESTABLISHED:
         srv = self.ts3host.getServer(schid)
         self.tabs[schid] = {
             "channelBanGroup": None,
             "channelModGroup": None,
             # "clients": {}
         }
         srv.requestServerGroupList()
         srv.requestChannelGroupList()
         self.tabs[schid][
             "name"] = srv.name  # ts3lib.getServerVariable(schid, VirtualServerProperties.VIRTUALSERVER_NAME)
         err, self.tabs[schid]["host"], self.tabs[schid]["port"], self.tabs[
             schid]["pw"] = ts3lib.getServerConnectInfo(schid)
         self.tabs[schid]["address"] = '{}:{}'.format(
             self.tabs[schid]["host"], self.tabs[schid]["port"]) if hasattr(
                 self.tabs[schid], 'port') else self.tabs[schid]["host"]
         self.tabs[schid]["clid"] = srv.me.clientID
         self.tabs[schid][
             "nick"] = srv.me.name  # ts3lib.getClientSelfVariable(schid, ClientProperties.CLIENT_NICKNAME) # ts3lib.getClientVariable(schid, self.tabs[schid]["clid"], ClientProperties.CLIENT_NICKNAME)
         err, self.tabs[schid][
             "nick_phonetic"] = ts3lib.getClientSelfVariable(
                 schid, ClientPropertiesRare.CLIENT_NICKNAME_PHONETIC)
         self.tabs[schid][
             "uid"] = srv.me.uid  # ts3lib.getClientSelfVariable(schid, ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
         err, self.tabs[schid]["token"] = ts3lib.getClientSelfVariable(
             schid, ClientPropertiesRare.CLIENT_DEFAULT_TOKEN)
         self.tabs[schid][
             "cid"] = srv.me.channel.channelID  # ts3lib.getChannelOfClient(schid, self.tabs[schid]["clid"])
         err, self.tabs[schid]["cpath"], self.tabs[schid][
             "cpw"] = ts3lib.getChannelConnectInfo(schid,
                                                   self.tabs[schid]["cid"])
         err, self.tabs[schid][
             "input_muted"] = ts3lib.getClientSelfVariable(
                 schid,
                 ClientProperties.CLIENT_INPUT_MUTED)  # srv.me.isInputMuted
         err, self.tabs[schid][
             "input_deactivated"] = ts3lib.getClientSelfVariable(
                 schid, ClientProperties.CLIENT_INPUT_DEACTIVATED)
         err, self.tabs[schid][
             "input_enabled"] = ts3lib.getClientSelfVariable(
                 schid, ClientProperties.CLIENT_INPUT_HARDWARE)
         err, self.tabs[schid][
             "output_muted"] = ts3lib.getClientSelfVariableAsInt(
                 schid, ClientProperties.CLIENT_OUTPUT_MUTED
             )  # srv.me.isOutputMuted
         err, self.tabs[schid][
             "output_enabled"] = ts3lib.getClientSelfVariable(
                 schid, ClientProperties.CLIENT_OUTPUT_HARDWARE)
     # elif status == ConnectStatus.STATUS_DISCONNECTED:
     if schid in self.tabs: self.tabs[schid]["status"] = status
コード例 #22
0
ファイル: __init__.py プロジェクト: arrellik1337/TestScript
 def onMenuItemEvent(self, schid, atype, menuItemID, selectedItemID):
     if menuItemID == 0:
         if self.timer is None:
             self.timer = QTimer()
             self.timer.timeout.connect(self.tick)
         if self.timer.isActive():
             self.timer.stop()
             self.timer = None
             ts3lib.setClientSelfVariableAsString(
                 schid, ts3defines.ClientProperties.CLIENT_NICKNAME,
                 self.nick)
             ts3lib.flushClientSelfUpdates(schid)
             ts3lib.printMessageToCurrentTab('Timer stopped!')
         else:
             (err, self.nick) = ts3lib.getClientSelfVariable(
                 schid, ts3defines.ClientProperties.CLIENT_NICKNAME)
             self.schid = schid
             (err, self.clid) = ts3lib.getClientID(schid)
             self.timer.start(1000)
             ts3lib.printMessageToCurrentTab('Timer started!')
コード例 #23
0
 def onHotkeyOrCommandEvent(self, keyword, schid=0):
     if not schid: schid = ts3lib.getCurrentServerConnectionHandlerID()
     if keyword == "request_talk_power":
         (err, oldnick) = ts3lib.getClientSelfVariable(
             schid, ts3defines.ClientProperties.CLIENT_NICKNAME)
         ts3lib.setClientSelfVariableAsString(
             schid, ts3defines.ClientProperties.CLIENT_NICKNAME,
             self.tpr_name)
         ts3lib.flushClientSelfUpdates(schid)
         if self.hook:
             sendCommand(self.name, "clientupdate client_is_recording=1",
                         schid)
             sendCommand(self.name, "clientupdate client_is_recording=0",
                         schid)
         else:
             ts3lib.startVoiceRecording(schid)
             ts3lib.stopVoiceRecording(schid)
         ts3lib.setClientSelfVariableAsString(
             schid, ts3defines.ClientProperties.CLIENT_NICKNAME, oldnick)
         ts3lib.flushClientSelfUpdates(schid)
コード例 #24
0
ファイル: __init__.py プロジェクト: jelidi/pyTSon_plugins
 def on_btn_start_clicked(self):
     try:
         if not self.rotateNick.timer.isActive():
             (err, _nick) = ts3lib.getClientSelfVariable(
                 self.rotateNick.schid,
                 ts3defines.ClientProperties.CLIENT_NICKNAME)
             if self.customNick.checked:
                 nick = self.nick.text
             else:
                 nick = _nick
             self.rotateNick._nick = _nick
             self.rotateNick.separator(self.separator.text)
             # self.rotateNick.config.set('general', 'separator', self.separator.text)
             self.rotateNick.startTimer(self.interval.value, nick)
             self.btn_start.setText("Stop")
         else:
             self.rotateNick.stopTimer()
             self.btn_start.setText("Start")
         # elf.close()
     except:
         from traceback import format_exc
         ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR,
                           "pyTSon", 0)
コード例 #25
0
ファイル: __init__.py プロジェクト: sancakbeyy/pyTSon_plugins
 def reconnect(self, schid=0, cid=0):
     if not schid: schid = ts3lib.getCurrentServerConnectionHandlerID()
     err, host, port, pw = ts3lib.getServerConnectInfo(schid)
     address = host if not "." in host else "{}:{}".format(host, port)
     # ts3lib.stopConnection(schid, "")
     err, nickname = ts3lib.getClientSelfVariable(
         schid, ts3defines.ClientProperties.CLIENT_NICKNAME)
     err, nickname_phonetic = ts3lib.getClientSelfVariable(
         schid, ts3defines.ClientPropertiesRare.CLIENT_NICKNAME_PHONETIC)
     err, uid = ts3lib.getClientSelfVariable(
         schid, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
     cpw = ""
     if not cid:
         err, cid = ts3lib.getClientSelfVariable(
             schid, ts3defines.ClientProperties.CLIENT_DEFAULT_CHANNEL)
         err, cpw = ts3lib.getClientSelfVariable(
             schid,
             ts3defines.ClientProperties.CLIENT_DEFAULT_CHANNEL_PASSWORD)
     else:
         (err, cid, cpw) = ts3lib.getChannelConnectInfo(schid, cid)
     err, default_token = ts3lib.getClientSelfVariable(
         schid, ts3defines.ClientPropertiesRare.CLIENT_DEFAULT_TOKEN)
     args = [
         ts3defines.PluginConnectTab.
         PLUGIN_CONNECT_TAB_CURRENT,  # connectTab: int,
         address,  #                                                serverLabel: Union[str, unicode],
         address,  #                                                serverAddress: Union[str, unicode],
         pw,  #                                                     serverPassword: Union[str, unicode],
         nickname,  #                                               nickname: Union[str, unicode],
         cid,  #                                                    channel: Union[str, unicode],
         cpw if cpw else
         "123",  #                                  channelPassword: Union[str, unicode]
         "",  #                                                     captureProfile: Union[str, unicode],
         "",  #                                                     playbackProfile: Union[str, unicode]
         "",  #                                                     hotkeyProfile: Union[str, unicode],
         "Default Sound Pack (Female)",  #                          soundPack
         uid,  #                                      userIdentity: Union[str, unicode],
         default_token,  #                                          oneTimeKey: Union[str, unicode],
         nickname_phonetic,  #                                      phoneticName: Union[str, unicode]
     ]
     print("ts3lib.guiConnect({})".format("\", \"".join(
         str(x) for x in args)))
     ts3lib.guiConnect(args[0], args[1], args[2], args[3], args[4], args[5],
                       args[6], args[7], args[8], args[9], args[10],
                       args[11], args[12], args[13])
コード例 #26
0
 def updateClient(self, schid):
     (err, name) = ts3lib.getClientSelfVariable(
         schid, ts3defines.ClientProperties.CLIENT_NICKNAME)
     from unidecode import unidecode
     self.activity["assets"]["large_text"] = unidecode(name)
コード例 #27
0
 def on_btn_ban_clicked(self):
     try:
         ip = self.txt_ip.text if self.grp_ip.isChecked() else ""
         name = self.txt_name.text if self.grp_name.isChecked() else ""
         uid = self.txt_uid.text if self.grp_uid.isChecked() else ""
         mytsid = self.txt_mytsid.text if self.grp_mytsid.isChecked(
         ) else ""
         hwid = self.txt_hwid.text if self.grp_hwid.isVisible(
         ) and self.grp_hwid.isChecked() else ""
         _reason = self.box_reason.currentText
         delta = timedelta(seconds=self.int_duration_s.value,
                           minutes=self.int_duration_m.value,
                           hours=self.int_duration_h.value,
                           days=self.int_duration_d.value)
         # duration = self.templates[_reason]
         err, ownnick = ts3lib.getClientSelfVariable(
             self.schid, ts3defines.ClientProperties.CLIENT_NICKNAME)
         reason = "{}{}{}".format(self.prefix, _reason, self.suffix)
         # delta = timedelta(seconds=duration)
         print(delta)
         reason = reason.replace("%ownnick%",
                                 ownnick).replace("%duration%", str(delta))
         # if reason[0].isdigit(): reason = "" + reason
         duration = int(delta.total_seconds())
         if self.moveBeforeBan:
             ts3lib.requestClientMove(self.schid, self.clid, 26, "")
         # if uid:
         if ip:
             check = True
             if len(self.whitelist) < 1:
                 check = confirm(
                     "Empty IP Whitelist!",
                     "The IP whitelist is empty! Are you sure you want to ban \"{}\"?\n\nMake sure your whitelist URL\n{}\nis working!"
                     .format(ip, self.cfg.get("general", "whitelist")))
             if ip in self.whitelist:
                 ts3lib.printMessageToCurrentTab(
                     "{}: [color=red]Not banning whitelisted IP [b]{}".
                     format(self.name, ip))
             elif check:
                 ts3lib.banadd(self.schid, ip, "", "", duration, reason)
         if name: ts3lib.banadd(self.schid, "", name, "", duration, reason)
         if uid: ts3lib.banadd(self.schid, "", "", uid, duration, reason)
         if mytsid:
             ts3lib.requestSendClientQueryCommand(
                 self.schid,
                 "banadd mytsid={id} banreason={reason} time={duration}".
                 format(id=mytsid,
                        reason=escapeStr(reason),
                        duration=duration))
         if hwid:
             ts3lib.requestSendClientQueryCommand(
                 self.schid,
                 "banadd hwid={id} banreason={reason} time={duration}".
                 format(id=hwid,
                        reason=escapeStr(reason),
                        duration=duration))
         # msgBox("schid: %s\nip: %s\nname: %s\nuid: %s\nduration: %s\nreason: %s"%(self.schid, ip, name, uid, duration, reason))
         self.cfg["last"] = {
             "ip": str(self.grp_ip.isChecked()),
             "name": str(self.grp_name.isChecked()),
             "uid": str(self.grp_uid.isChecked()),
             "mytsid": str(self.grp_mytsid.isChecked()),
             "hwid": str(self.grp_hwid.isChecked()),
             "reason": _reason,
             "duration": str(duration),
             "expanded": str(self.lst_reasons.isVisible()),
             "height": str(self.height),
             "alternate": str(self.chk_alternate.isChecked()),
             "ban on doubleclick": str(self.chk_doubleclick.isChecked()),
         }
         if not self.chk_keep.isChecked():
             self.close()
     except:
         ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR,
                           "pyTSon", 0)
コード例 #28
0
ファイル: __init__.py プロジェクト: sancakbeyy/pyTSon_plugins
 def onConnectStatusChangeEvent(self, schid, newStatus, errorNumber):
     if not self.cfg.getboolean("general", "enabled"): return
     if newStatus == ts3defines.ConnectStatus.STATUS_CONNECTION_ESTABLISHED:
         err, mic = ts3.getClientSelfVariable(
             schid, ts3defines.ClientProperties.CLIENT_INPUT_HARDWARE)
         if not err and not mic: self.setStatus(schid)
コード例 #29
0
ファイル: __init__.py プロジェクト: sancakbeyy/pyTSon_plugins
    def setStatus(self, schid):
        err, ownid = ts3.getClientID(schid)
        err, schids = ts3.getServerConnectionHandlerList()

        regex = re.compile(r'.*(<{0}>.*</{0}>).*'.format(self.tag),
                           re.IGNORECASE)

        host = ""
        port = 9987
        pw = ""
        name = ""
        nick = ""

        err, host, port, pw = ts3.getServerConnectInfo(schid)
        err, name = ts3.getServerVariable(
            schid, ts3defines.VirtualServerProperties.VIRTUALSERVER_NAME)
        err, nick = ts3.getServerVariable(
            schid, 83
        )  # ts3defines.VirtualServerPropertiesRare.VIRTUALSERVER_NICKNAME
        if err == ts3defines.ERROR_ok and nick.strip(): nick = nick.split(":")
        err, ip = ts3.getConnectionVariableAsString(
            schid, ownid, ts3defines.ConnectionProperties.CONNECTION_SERVER_IP)
        if err != ts3defines.ERROR_ok or not ip.strip():
            err, ip = ts3.getServerVariableAsString(
                schid, ts3defines.VirtualServerPropertiesRare.VIRTUALSERVER_IP)
        err, port = ts3.getConnectionVariableAsString(
            schid, ownid,
            ts3defines.ConnectionProperties.CONNECTION_SERVER_PORT)
        if err != ts3defines.ERROR_ok or not port or port < 1:
            err, port = ts3.getServerVariableAsString(
                schid,
                ts3defines.VirtualServerPropertiesRare.VIRTUALSERVER_PORT)

        for tab in schids:
            err, meta_data = ts3.getClientSelfVariable(
                tab, ts3defines.ClientProperties.CLIENT_META_DATA)
            meta_data = regex.sub("", meta_data)
            if tab == schid:
                ts3.setClientSelfVariableAsInt(
                    tab, ts3defines.ClientPropertiesRare.CLIENT_AWAY,
                    ts3defines.AwayStatus.AWAY_NONE)
            else:
                err, away = ts3.getClientSelfVariable(
                    tab, ts3defines.ClientPropertiesRare.CLIENT_AWAY)
                if away != ts3defines.AwayStatus.AWAY_ZZZ:
                    ts3.setClientSelfVariableAsInt(
                        tab, ts3defines.ClientPropertiesRare.CLIENT_AWAY,
                        ts3defines.AwayStatus.AWAY_ZZZ)
                if self.cfg.getboolean('general', 'enabled'):
                    if host:
                        newmeta = xml.Element(self.tag)
                        c = xml.SubElement(newmeta, "tab")
                        c.set("i", str(schid))
                        if name: c.text = escape(name.strip())
                        c.set("h", escape(host))
                        if port and port != 9987:
                            c.set("port", "{}".format(port))
                        if pw and self.cfg.getboolean('general', 'pw'):
                            c.set("p", pw)
                        # if ip and ip.strip(): c.set("ip", ip)
                        # if nick: c.set("nick", ":".join(nick))
                        meta_data = "{old}{new}".format(
                            old=meta_data,
                            new=xml.tostring(newmeta).decode("utf-8"))
                        # meta_data = "{}<server>{}{}</server>".format(meta_data, ip, ":" + port if port else "")
                try:
                    name = name[:78] + (name[78:] and '..')
                except:
                    pass
                _away_message = self.cfg.get('general', 'status')
                if "{" in _away_message:
                    _away_message = _away_message\
                    .replace('{host}', host if host else "")\
                    .replace('{nick}', nick[0] if nick and len(nick) > 0 else "")\
                    .replace('{name}', name if name else "")\
                    .replace('{nickname}', nick[0] if nick else name)\
                    .replace('{ip}', ip if ip else "")\
                    .replace('{port}', str(port) if port else "")
                err, away_message = ts3.getClientSelfVariable(
                    tab, ts3defines.ClientPropertiesRare.CLIENT_AWAY_MESSAGE)
                if away_message != _away_message:
                    ts3.setClientSelfVariableAsString(
                        tab,
                        ts3defines.ClientPropertiesRare.CLIENT_AWAY_MESSAGE,
                        _away_message)
            ts3.setClientSelfVariableAsString(
                tab, ts3defines.ClientProperties.CLIENT_META_DATA, meta_data)
            ts3.flushClientSelfUpdates(tab)
コード例 #30
0
 def setStatus(self, schid):
     try:
         err, ownid = ts3.getClientID(schid)
         err, schids = ts3.getServerConnectionHandlerList()
         regex = re.compile(r'.*(<{0}>.*</{0}>).*'.format(self.tag),
                            re.IGNORECASE)
         for tab in schids:
             err, meta_data = ts3.getClientSelfVariable(
                 tab, ts3defines.ClientProperties.CLIENT_META_DATA)
             meta_data = regex.sub("", meta_data)
             if tab == schid:
                 ts3.setClientSelfVariableAsInt(
                     tab, ts3defines.ClientPropertiesRare.CLIENT_AWAY,
                     ts3defines.AwayStatus.AWAY_NONE)
             else:
                 err, away_message = ts3.getClientSelfVariable(
                     tab,
                     ts3defines.ClientPropertiesRare.CLIENT_AWAY_MESSAGE)
                 err, away = ts3.getClientSelfVariable(
                     tab, ts3defines.ClientPropertiesRare.CLIENT_AWAY)
                 if away != ts3defines.AwayStatus.AWAY_ZZZ:
                     ts3.setClientSelfVariableAsInt(
                         tab, ts3defines.ClientPropertiesRare.CLIENT_AWAY,
                         ts3defines.AwayStatus.AWAY_ZZZ)
                 host = ""
                 port = 0
                 name = ""
                 if self.cfg.getboolean('general', 'enabled'):
                     err, host, port, pw = ts3.getServerConnectInfo(schid)
                     # err, ip = ts3.getConnectionVariableAsString(schid, ownid, ts3defines.ConnectionProperties.CONNECTION_SERVER_IP)
                     # err, port = ts3.getConnectionVariableAsString(schid, ownid, ts3defines.ConnectionProperties.CONNECTION_SERVER_PORT)
                     # err, ip = ts3.getServerVariableAsString(schid, ts3defines.VirtualServerPropertiesRare.VIRTUALSERVER_IP)
                     # err, port = ts3.getServerVariableAsString(schid, ts3defines.VirtualServerPropertiesRare.VIRTUALSERVER_PORT)
                     if host:
                         newmeta = xml.Element(self.tag)
                         c = xml.SubElement(newmeta, "tab")
                         c.set("id", str(schid))
                         err, name = ts3.getServerVariable(
                             schid, ts3defines.VirtualServerProperties.
                             VIRTUALSERVER_NAME)
                         if name: c.text = escape(name.strip())
                         c.set("host", escape(host))
                         if port and port != 9987:
                             c.set("port", "{}".format(port))
                         if pw and self.cfg.getboolean('general', 'pw'):
                             c.set("pw", pw)
                         meta_data = "{old}{new}".format(
                             old=meta_data,
                             new=xml.tostring(newmeta).decode("utf-8"))
                         # meta_data = "{}<server>{}{}</server>".format(meta_data, ip, ":" + port if port else "")
                 _away_message = self.cfg.get('general', 'status').replace(
                     '{host}', host if host else "").replace(
                         '{name}', name if name else "").replace(
                             '{port}',
                             str(port) if port else "")
                 if away_message != _away_message:
                     ts3.setClientSelfVariableAsString(
                         tab, ts3defines.ClientPropertiesRare.
                         CLIENT_AWAY_MESSAGE, _away_message)
             ts3.setClientSelfVariableAsString(
                 tab, ts3defines.ClientProperties.CLIENT_META_DATA,
                 meta_data)
             ts3.flushClientSelfUpdates(tab)
     except:
         from traceback import format_exc
         ts3.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR,
                        "pyTSon", 0)
         pass