Ejemplo n.º 1
0
 def onUpdateChannelEditedEvent(self, schid, channelID, invokerID,
                                invokerName, invokerUniqueIdentifier):
     if self.debug:
         ts3lib.printMessageToCurrentTab(
             "self.schid: {0} | schid: {1}".format(self.schid, schid))
     if self.debug:
         ts3lib.printMessageToCurrentTab(
             "self.channel: {0} | channelID: {1}".format(
                 self.channel, channelID))
     if self.schid == schid and self.channel == channelID:
         clients = self.channelClientCount(schid, channelID)
         if self.debug:
             ts3lib.printMessageToCurrentTab("clients: {0}".format(clients))
         (error, maxclients) = ts3lib.getChannelVariableAsUInt64(
             schid, channelID,
             ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS)
         if self.debug:
             ts3lib.printMessageToCurrentTab(
                 "error: {0} | maxclients: {1}".format(error, maxclients))
         (error, maxfamilyclients) = ts3lib.getChannelVariableAsUInt64(
             schid, channelID,
             ts3defines.ChannelProperties.CHANNEL_MAXFAMILYCLIENTS)
         if self.debug:
             ts3lib.printMessageToCurrentTab(
                 "error: {0} | maxfamilyclients: {1}".format(
                     error, maxfamilyclients))
         if clients < maxclients and clients < maxfamilyclients:
             (error, ownID) = ts3lib.getClientID(schid)
             ts3lib.requestClientMove(schid, ownID, channelID,
                                      self.password)
             self.schid = 0
             self.channel = 0
             self.password = ""
             self.name = ""
Ejemplo n.º 2
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 ""
         reason = self.box_reason.currentText
         if reason[0].isdigit():
             reason = "§" + reason
         duration = self.int_duration.value
         if self.moveBeforeBan: ts3lib.requestClientMove(self.schid, self.clid, 26, "")
         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)
         # 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()),
             "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)
Ejemplo n.º 3
0
 def onClientMoveEvent(self, schid, clientID, oldChannelID, newChannelID,
                       visibility, moveMessage):
     if self.schid == schid and self.channel == oldChannelID:
         clients = self.channelClientCount(schid, oldChannelID)
         if self.debug:
             ts3lib.printMessageToCurrentTab("clients: {0}".format(clients))
         (error, maxclients) = ts3lib.getChannelVariableAsUInt64(
             schid, oldChannelID,
             ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS)
         if self.debug:
             ts3lib.printMessageToCurrentTab(
                 "error: {0} | maxclients: {1}".format(error, maxclients))
         (error, maxfamilyclients) = ts3lib.getChannelVariableAsUInt64(
             schid, oldChannelID,
             ts3defines.ChannelProperties.CHANNEL_MAXFAMILYCLIENTS)
         if self.debug:
             ts3lib.printMessageToCurrentTab(
                 "error: {0} | maxfamilyclients: {1}".format(
                     error, maxfamilyclients))
         if clients < maxclients and clients < maxfamilyclients:
             (error, ownID) = ts3lib.getClientID(schid)
             ts3lib.requestClientMove(schid, ownID, oldChannelID,
                                      self.password)
             self.schid = 0
             self.channel = 0
             self.password = ""
             self.name = ""
         else:
             ts3lib.printMessageToCurrentTab(
                 "{0} left channel [url=channelid://{1}]{2}[/url]. [color=red]{3}[/color] client(s) remaining."
                 .format(self.clientURL(schid, clientID), channel, name,
                         maxclients - clients + 1))
Ejemplo n.º 4
0
 def onHotkeyOrCommandEvent(self, keyword, schid=0):
     if not schid: schid = ts3lib.getCurrentServerConnectionHandlerID()
     if not self.schids or len(self.schids) < 1 or schid != self.schids[0] or not self.supchan: return
     if keyword == "move_first_from_waiting_room":
         (err, clids) = ts3lib.getChannelClientList(schid, self.supchan)
         (err, ownID) = ts3lib.getClientID(schid)
         (err, ownCID) = ts3lib.getChannelOfClient(schid, ownID)
         ts3lib.requestClientMove(schid, clids[0], ownCID, "")
Ejemplo n.º 5
0
 def onClientKickFromChannelEvent(self, schid, clientID, oldChannelID, newChannelID, visibility, kickerID, kickerName, kickerUniqueIdentifier, kickMessage):
     (error, ownid) = ts3lib.getClientID(schid)
     if self.insupport == clientID and oldChannelID == self.cursupchan and kickerID == ownid:
         if self.wasmuted: ts3lib.setClientSelfVariableAsInt(schid, ts3defines.ClientProperties.CLIENT_OUTPUT_MUTED, 1);ts3lib.flushClientSelfUpdates(schid)
         ts3lib.requestClientMove(schid, ownid, self.oldchan, "")
         ts3lib.printMessageToCurrentTab("Not longer in support with client #{0} in channel #{1}".format(self.insupport, self.cursupchan))
         self.insupport = 0;self.cursupchan = 0;self.oldchan = 0
     if self.debug: ts3lib.printMessageToCurrentTab("onClientKickFromChannelEvent: insupport: {0} | cursupchan: {1} | oldchan: {2}".format(self.insupport,self.cursupchan, self.oldchan))
Ejemplo n.º 6
0
 def joinTarget(self, schid=0):
     if not schid: schid = ts3lib.getCurrentServerConnectionHandlerID()
     (err, ownID) = ts3lib.getClientID(schid)
     (err, ownCID) = ts3lib.getChannelOfClient(schid, ownID)
     (err, cid) = ts3lib.getChannelOfClient(schid, self.targets[schid])
     if ownCID == cid: return
     (err, path, pw) = ts3lib.getChannelConnectInfo(schid, cid)
     ts3lib.requestClientMove(schid, ownID, cid, pw)
Ejemplo n.º 7
0
 def TryJoinChannel(self, serverConnectionHandlerID, clientID, wantedChannelID):
     #verifyChannelPassword(serverConnectionHandlerID, channelID, channelPassword, returnCode)
     channelHasPassword = ts3lib.getChannelVariableAsInt(serverConnectionHandlerID, wantedChannelID, ts3defines.ChannelProperties.CHANNEL_FLAG_PASSWORD)[1]
     if channelHasPassword == 1:
         ts3lib.requestClientMove(serverConnectionHandlerID, clientID, wantedChannelID, self.currentChannelPW)
     else:
         ts3lib.requestClientMove(serverConnectionHandlerID, clientID, wantedChannelID, "")
     self.backup(serverConnectionHandlerID)
     return
Ejemplo n.º 8
0
 def onHotkeyOrCommandEvent(self, keyword, schid=0):
     if not schid: schid = ts3lib.getCurrentServerConnectionHandlerID()
     if keyword == "restrict_last_joined_server":
         self.requested = self.last_joined_server
         msg = self.cfg.get("restrict", "poke")
         if msg: ts3lib.requestClientPoke(schid, self.requested, msg)
         ts3lib.requestClientVariables(schid, self.last_joined_server)
         # self.restrictClient(schid, self.last_joined_server)
     elif keyword == "restrict_last_joined_channel":
         self.requested = self.last_joined_channel
         msg = self.cfg.get("restrict", "poke")
         if msg: ts3lib.requestClientPoke(schid, self.requested, msg)
         ts3lib.requestClientVariables(schid, self.last_joined_channel)
         # self.restrictClient(schid, self.last_joined_channel)
     elif keyword == "ban_last_joined_server":
         msg = self.cfg.get("ban", "poke")
         if msg:
             ts3lib.requestClientPoke(schid, self.last_joined_server, msg)
         self.banClient(schid, self.last_joined_server)
     elif keyword == "ban_last_joined_channel":
         msg = self.cfg.get("ban", "poke")
         if msg:
             ts3lib.requestClientPoke(schid, self.last_joined_channel, msg)
         self.banClient(schid, self.last_joined_channel)
     elif keyword == "revoke_last_talk_power_channel":
         self.revokeTalkPower(schid, self.last_talk_power)
     elif keyword == "restrict_last_joined_channel_from_local_channels":
         self.restrictForeigners(schid, self.last_joined_channel)
     elif keyword == "last_joined_channel_to_customBan":
         self.toCustomBan(schid, self.last_joined_channel)
     elif keyword == "last_joined_server_to_customBan":
         self.toCustomBan(schid, self.last_joined_server)
     elif keyword == "join_selected_channel_pw":
         window = self.app.activeWindow()
         if window is None or not window.className() == "MainWindow": return
         selected = widget("ServerTreeView", self.app).currentIndex()
         if not selected: return
         name = selected.data()
         item = getIDByName(name, schid)
         if item[1] != ServerTreeItemType.CHANNEL: return
         (err, clid) = ts3lib.getClientID(schid)
         (err, cid) = ts3lib.getChannelOfClient(schid, clid)
         if cid == item[0]: return
         pw = getChannelPassword(schid, item[0], calculate=True)
         if not pw: return
         # ts3lib.printMessageToCurrentTab("{} > Joining {} (pw: {})".format(self.name, name, pw))
         ts3lib.requestClientMove(schid, clid, item[0], pw)
     elif keyword == "rejoin_last_channel_pw":
         (err, clid) = ts3lib.getClientID(schid)
         (err, cid) = ts3lib.getChannelOfClient(schid, clid)
         tcid = self.lastchans[schid]
         if cid == tcid: return
         pw = getChannelPassword(schid, tcid, calculate=True)
         # (err, name) = ts3lib.getChannelVariable(schid, tcid, ts3defines.ChannelProperties.CHANNEL_NAME)
         # ts3lib.printMessageToCurrentTab("{} > Rejoining {} (pw: {})".format(self.name, name, pw))
         ts3lib.requestClientMove(schid, clid, tcid, pw if pw else "123")
Ejemplo n.º 9
0
 def onClientMoveEvent(self, schid, clid, oldChannelID, newChannelID, visibility, moveMessage):
     if not self.schids or len(self.schids) < 1 or schid != self.schids[0]: return
     if not self.supchan in [newChannelID, oldChannelID]: return
     (err, ownID) = ts3lib.getClientID(schid)
     (err, ownCID) = ts3lib.getChannelOfClient(schid, ownID)
     mycid = ts3lib.getChannelIDFromChannelNames(schid, self.cfg.get("general", "mychan").split(","))
     (err, clients) = ts3lib.getChannelClientList(schid, mycid); clients = len(clients)
     if ownCID == mycid and clients == 1 and newChannelID == self.supchan:
         ts3lib.requestClientMove(schid, clid, mycid, "")
     else: self.checkChannel(schid)
Ejemplo n.º 10
0
 def joinTarget(self, schid = 0, cid = 0):
     if not schid: schid = ts3lib.getCurrentServerConnectionHandlerID()
     (err, ownID) = ts3lib.getClientID(schid)
     (err, ownCID) = ts3lib.getChannelOfClient(schid, ownID)
     clid = getClientIDByUID(schid, self.targets[schid])
     if not cid: (err, cid) = ts3lib.getChannelOfClient(schid, clid)
     if ownCID == cid: return
     pw = getChannelPassword(schid, cid, True)
     ts3lib.requestClientMove(schid, ownID, cid, pw if pw else "")
     self.cid = 0
Ejemplo n.º 11
0
 def onClientMoveEvent(self, serverConnectionHandlerID, clientID, oldChannelID, newChannelID, visibility, moveMessage):
     try:
         if newChannelID in self.sourceChannel:
             if len(self.destinationChannel) > 0:
                 destChannel = self.destinationChannel[0] #TODO: Check which channel is best
                 (err, path, password) = ts3lib.getChannelConnectInfo(serverConnectionHandlerID, destChannel)
                 ts3lib.requestClientMove(serverConnectionHandlerID, clientID, destChannel, password)
             else:
                 ts3lib.printMessageToCurrentTab("No Destination Channel availabe.")
     except: from traceback import format_exc;ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "pyTSon", 0)
Ejemplo n.º 12
0
 def onMenuItemEvent(self, schid, atype, menuItemID, channel):
     if atype != ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_CHANNEL: return
     try:
         (error, ownID) = ts3lib.getClientID(schid)
         (error, maxclients) = ts3lib.getChannelVariable(
             schid, channel,
             ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS)
         if self.debug:
             ts3lib.printMessageToCurrentTab(
                 "error: {0} | maxclients: {1}".format(error, maxclients))
         if menuItemID == 0:
             pw = inputBox("Enter Channel Password", "Password:"******"clients: {0}".format(clients))
             (error, maxfamilyclients) = ts3lib.getChannelVariable(
                 schid, channel,
                 ts3defines.ChannelProperties.CHANNEL_MAXFAMILYCLIENTS)
             if self.debug:
                 ts3lib.printMessageToCurrentTab(
                     "error: {0} | maxfamilyclients: {1}".format(
                         error, maxfamilyclients))
             if clients < maxclients and clients < maxfamilyclients:
                 ts3lib.requestClientMove(schid, ownID, channel, pw)
                 return True
             (error, name) = ts3lib.getChannelVariableAsString(
                 schid, channel, ts3defines.ChannelProperties.CHANNEL_NAME)
             self.schid = schid
             self.channel = channel
             self.password = pw
             self.cname = name
             if not pw:
                 ts3lib.printMessageToCurrentTab(
                     "Queued for channel [url=channelid://{0}]{1}[/url]. [color=red]{2}[/color] client(s) remaining."
                     .format(channel, name, maxclients - clients + 1))
             else:
                 ts3lib.printMessageToCurrentTab(
                     "Queued for channel [url=channelid://{0}]{1}[/url] with password \"{2}\". [color=red]{3}[/color] client(s) remaining."
                     .format(channel, name, pw, maxclients - clients + 1))
         elif menuItemID == 1:
             pw = inputBox("Enter Channel Password", "Password:"******"pyTSon", 0)
Ejemplo n.º 13
0
 def onUpdateChannelEditedEvent(self, schid, channelID, invokerID, invokerName, invokerUniqueIdentifier):
     if not self.cid == channelID: return
     if not self.schid == schid: return
     (err, haspw) = ts3lib.getChannelVariable(schid, channelID, ChannelProperties.CHANNEL_FLAG_PASSWORD)
     if haspw: return
     self.timer.stop()
     (err, name) = ts3lib.getChannelVariable(schid, channelID, ChannelProperties.CHANNEL_NAME)
     if confirm("Password removed", "Password was removed from channel \"{0}\" by \"{1}\"\n\nDo you want to join now?".format(name, invokerName)):
         (err, ownID) = ts3lib.getClientID(self.schid)
         ts3lib.requestClientMove(schid, ownID, channelID, "")
     self.schid = 0;self.cid = 0;self.pwc = 0
Ejemplo n.º 14
0
 def commandChannelMessage(self, schid, targetMode, toID, fromID, params=""):
     try:
         _p = params.split(" ",1);target = int(_p[0]);message = _p[1]
         if self.cfg.getboolean("general", "debug"): ts3lib.printMessageToCurrentTab("Found Channel ID: {0}".format(target))
     except:
         (error, target) = ts3lib.getChannelOfClient(schid, fromID);message = params
         if self.cfg.getboolean("general", "debug"): ts3lib.printMessageToCurrentTab("Found No Channel ID.")
     (error, ownID) = ts3lib.getClientID(schid)
     (error, ownChan) = ts3lib.getChannelOfClient(schid, ownID)
     if not ownChan == target: ts3lib.requestClientMove(schid, ownID, target, "123")
     ts3lib.requestSendChannelTextMsg(schid, "Message from {0}: {1}".format(self.clientURL(schid, fromID), message), target)
     if not ownChan == target: ts3lib.requestClientMove(schid, ownID, ownChan, "123")
Ejemplo n.º 15
0
 def onClientMoveEvent(self, schid, clientID, oldChannelID, newChannelID,
                       visibility, moveMessage):
     if not self.config.getboolean("general", "enabled"): return
     if not str(clientID) in self.clids: return
     (err, ownID) = ts3lib.getClientID(schid)
     if clientID == ownID: return
     (err, ownCID) = ts3lib.getChannelOfClient(schid, clientID)
     if newChannelID != ownCID: return
     chan = 0
     while chan <= 0 or chan == newChannelID:
         chan = choice(self.cids)
     ts3lib.requestClientMove(schid, ownID, chan, "123")
Ejemplo n.º 16
0
 def banClient(self, schid, clid):
     (err, uid) = ts3lib.getClientVariable(
         schid, clid, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
     (err, ip) = ts3lib.getConnectionVariable(
         schid, clid, ts3defines.ConnectionProperties.CONNECTION_CLIENT_IP)
     if self.moveBeforeBan:
         ts3lib.requestClientMove(schid, clid, self.moveBeforeBan, "")
     if not ip:
         self.requestedIP = clid
         ts3lib.requestConnectionInfo(schid, clid)
     else:
         self.banIP(schid, ip)
         self.banUID(schid, uid)
Ejemplo n.º 17
0
 def stopsup(self, schid=1):
     (error, ownid) = ts3lib.getClientID(schid)
     ts3lib.requestClientMove(schid, ownid, self.oldchan, "")
     if self.wasmuted:
         ts3lib.setClientSelfVariableAsInt(
             schid, ts3defines.ClientProperties.CLIENT_OUTPUT_MUTED, 1)
     if self.debug:
         ts3lib.printMessageToCurrentTab(
             "Not longer in support with client #{0} in channel #{1}".
             format(self.insupport, self.cursupchan))
     self.insupport = 0
     self.cursupchan = 0
     self.oldchan = 0
Ejemplo n.º 18
0
 def onMenuItemEvent(self, schid, atype, menuItemID, channel):
     if atype == ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_CHANNEL and menuItemID == 0:
         try:
             x = QWidget()
             x.setAttribute(Qt.WA_DeleteOnClose)
             password = QInputDialog.getText(x, "Enter Channel Password",
                                             "Password:"******"clients: {0}".format(clients))
             (error, maxclients) = ts3lib.getChannelVariableAsUInt64(
                 schid, channel,
                 ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS)
             if self.debug:
                 ts3lib.printMessageToCurrentTab(
                     "error: {0} | maxclients: {1}".format(
                         error, maxclients))
             (error, maxfamilyclients) = ts3lib.getChannelVariableAsUInt64(
                 schid, channel,
                 ts3defines.ChannelProperties.CHANNEL_MAXFAMILYCLIENTS)
             if self.debug:
                 ts3lib.printMessageToCurrentTab(
                     "error: {0} | maxfamilyclients: {1}".format(
                         error, maxfamilyclients))
             if clients < maxclients and clients < maxfamilyclients:
                 (error, ownID) = ts3lib.getClientID(schid)
                 ts3lib.requestClientMove(schid, ownID, channel, password)
                 return True
             (error, name) = ts3lib.getChannelVariableAsString(
                 schid, channel, ts3defines.ChannelProperties.CHANNEL_NAME)
             self.schid = schid
             self.channel = channel
             self.password = password
             self.cname = name
             if password == "":
                 ts3lib.printMessageToCurrentTab(
                     "Queued for channel [url=channelid://{0}]{1}[/url]. [color=red]{2}[/color] client(s) remaining."
                     .format(channel, name, maxclients - clients + 1))
             else:
                 ts3lib.printMessageToCurrentTab(
                     "Queued for channel [url=channelid://{0}]{1}[/url] with password \"{2}\". [color=red]{3}[/color] client(s) remaining."
                     .format(channel, name, password,
                             maxclients - clients + 1))
         except:
             from traceback import format_exc
             ts3lib.logMessage(format_exc(),
                               ts3defines.LogLevel.LogLevel_ERROR, "pyTSon",
                               0)
Ejemplo n.º 19
0
 def joinTarget(self, schid=0, cid=0, pw=""):
     if not schid: schid = ts3lib.getCurrentServerConnectionHandlerID()
     (err, ownID) = ts3lib.getClientID(schid)
     (err, ownCID) = ts3lib.getChannelOfClient(schid, ownID)
     clid = getClientIDByUID(schid, self.targets[schid])
     if not cid: (err, cid) = ts3lib.getChannelOfClient(schid, clid)
     if ownCID == cid: return
     pw = getChannelPassword(schid, cid, False, False, True)
     pw = pw if pw else "123"
     # print(schid, ownID, cid, pw)
     ts3lib.printMessageToCurrentTab(
         "{} {}: Now following {} in channel {} with pw \"{}\"".format(
             timestamp(), self.name, clientURL(schid, clid),
             channelURL(schid, cid), pw))
     ts3lib.requestClientMove(schid, ownID, cid, pw)
     self.cid = 0
Ejemplo n.º 20
0
 def onClientMoveEvent(self, schid, clientID, oldChannelID, newChannelID,
                       visibility, moveMessage):
     if self.schid != schid: return
     if self.channel == oldChannelID:
         clients = self.channelClientCount(schid, oldChannelID)
         if self.debug:
             ts3lib.printMessageToCurrentTab("clients: {0}".format(clients))
         (error, maxclients) = ts3lib.getChannelVariable(
             schid, oldChannelID,
             ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS)
         if self.debug:
             ts3lib.printMessageToCurrentTab(
                 "error: {0} | maxclients: {1}".format(error, maxclients))
         (error, maxfamilyclients) = ts3lib.getChannelVariable(
             schid, oldChannelID,
             ts3defines.ChannelProperties.CHANNEL_MAXFAMILYCLIENTS)
         if self.debug:
             ts3lib.printMessageToCurrentTab(
                 "error: {0} | maxfamilyclients: {1}".format(
                     error, maxfamilyclients))
         if clients < maxclients and clients < maxfamilyclients:
             (error, ownID) = ts3lib.getClientID(schid)
             ts3lib.requestClientMove(schid, ownID, oldChannelID,
                                      self.password)
             self.schid = 0
             self.channel = 0
             self.password = ""
             self.name = ""
         else:
             ts3lib.printMessageToCurrentTab(
                 "{0} left channel {1}. [color=red]{2}[/color] client(s) remaining."
                 .format(clientURL(schid, clientID),
                         channelURL(schid, oldChannelID),
                         maxclients - clients + 1))
     print("fullchannel:", self.fullchannel, "newChannelID:", newChannelID)
     if self.fullchannel == newChannelID:
         self.fullchannel = 0
         (error, maxclients) = ts3lib.getChannelVariable(
             schid, newChannelID,
             ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS)
         ts3lib.setChannelVariableAsInt(
             schid, newChannelID,
             ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS,
             maxclients - 1)
         ts3lib.flushChannelUpdates(schid, newChannelID)
         self.schid = 0
Ejemplo n.º 21
0
 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")
Ejemplo n.º 22
0
 def onServerErrorEvent(self, schid, errorMessage, error, returnCode, extraMessage):
     if returnCode == "passwordCracker:manual":
         (err, name) = ts3lib.getChannelVariable(schid, self.cid, ChannelProperties.CHANNEL_NAME)
         errorMessage = errorMessage.title()
         msgBox("Channel: {0}\n\nPW: {1}\n\nResult: {2}".format(name, self.pw,errorMessage))
     if not returnCode == self.retcode: return
     errorMessage = errorMessage.title()
     if error == ERROR_channel_invalid_password:
         if self.flooding: self.flooding = False
         self.status = '[color=orange]{0}[/color]'.format(errorMessage)
         ts3lib.requestInfoUpdate(schid, PluginItemType.PLUGIN_CHANNEL, self.cid)
     elif error == ERROR_client_is_flooding:
         self.flooding = True
         self.timer.stop()
         QTimer.singleShot(self.antiflood_delay, self.startTimer)
         self.status = '[color=red]{0}[/color]'.format(errorMessage)
         ts3lib.requestInfoUpdate(schid, PluginItemType.PLUGIN_CHANNEL, self.cid)
     elif error == ERROR_channel_invalid_id:
         self.timer.stop()
         self.status = '[color=red]{0}[/color]'.format(errorMessage)
         ts3lib.requestInfoUpdate(schid, PluginItemType.PLUGIN_CHANNEL, self.cid)
         msgBox("Channel #{0} is invalid!\n\nStopping Cracker!".format(self.cid), QMessageBox.Warning)
     elif error == ERROR_ok:
         if self.flooding: self.flooding = False
         self.timer.stop()
         (err, name) = ts3lib.getChannelVariable(schid, self.cid, ChannelProperties.CHANNEL_NAME)
         ts3lib.printMessageToCurrentTab('Channel: {0} Password: \"{1}\"'.format(channelURL(schid, self.cid, name), self.pws[self.pwc-1] if self.mode == 0 else self.pwc-1))
         self.status = '[color=green]{0}[/color]'.format(errorMessage)
         ts3lib.requestInfoUpdate(schid, PluginItemType.PLUGIN_CHANNEL, self.cid)
         if confirm("Password found! ({0} / {1})".format(self.pwc, len(self.pws)) if self.mode == 0 else "Password found!",
                    "Password \"{0}\" was found for channel \"{1}\"\n\nDo you want to join now?".format(self.pws[self.pwc-1] if self.mode == 0 else self.pwc-1,name)):
             (err, ownID) = ts3lib.getClientID(schid)
             ts3lib.requestClientMove(schid, ownID, self.cid, self.pws[self.pwc-1] if self.mode == 0 else str(self.pwc-1))
     else:
         self.status = errorMessage
         ts3lib.requestInfoUpdate(schid, PluginItemType.PLUGIN_CHANNEL, self.cid)
     if error in [ERROR_channel_invalid_id, ERROR_ok] or returnCode in ["passwordCracker:manual"]: self.schid = 0;self.cid = 0;self.pwc = 0
     return 1
Ejemplo n.º 23
0
    def mouseDoubleClickEvent(self, event):
        try:
            if event.button() != Qt.LeftButton:
                return

            index = self.indexAt(event.pos())
        
            item = self.indexToObject(index)
            if not item:
                return
            if type(item) is Client:
                #open chat
                if item.isme: #don't chat with your self. get friends. TODO: change your name
                    #TODO: self.edit(index)
                    return
                treeView = self.parent()
                serverView = treeView.parent()
                #TODO: find better way to select or better way to open chat #TODO: maybe indexAt (needs same layout as old view tho) #set the original tree view index to our current
                #found = BoolResult()
                treeView.onSearchItemByName(item.name, QTextDocument.FindCaseSensitively | QTextDocument.FindWholeWords, True, False, True)
                #if found:
                serverView.onOpenChatRequest() #onOpenChatRequest(anyID) is useless (prolly called from action menu; opens chat tab for selected client)
            elif type(item) is Channel:
                #join channel
                (err, clid) = ts3lib.getClientID(self.schid)
                if err != ts3defines.ERROR_ok:
                    return
                if item.hasClient(clid): #check if we're already in the channel
                    return
                if not item.isPasswordProtected:
                    ts3lib.requestClientMove(self.schid, clid, item.cid, "")
                else:
                    pw = item.getPassword(True)
                    ts3lib.requestClientMove(self.schid, clid, item.cid, pw)
            #elif type(item) is Server:
                #do nothing i guess?
        except: from traceback import format_exc;ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "pyTSon", 0)
Ejemplo n.º 24
0
    def dropMimeData(self, mimedata, action, row, column, parent):
        if action != Qt.MoveAction:
            return False

        if not mimedata.hasText():
            return False

        if mimedata.text() == "":
            return True

        chan = self._indexObject(parent)
        assert type(chan) is Channel

        for clid in map(int, mimedata.text().split(" ")):
            err = ts3lib.requestClientMove(self.schid, clid, chan.cid, "")
            if err != ts3defines.ERROR_ok:
                print("error moving: %s" % err)

        return True
Ejemplo n.º 25
0
    def onClientMoveMovedEvent(self, schid, clientID, oldChannelID, newChannelID, visibility, moverID, moverName, moverUniqueIdentifier, moveMessage):
        try:
            (error, ownid) = ts3lib.getClientID(schid)
            (error, ownchan) = ts3lib.getChannelOfClient(schid, ownid)
            (error, afk) = ts3lib.getClientVariableAsInt(schid, ownid, ts3defines.ClientPropertiesRare.CLIENT_AWAY)
            if self.debug: ts3lib.printMessageToCurrentTab("onClientMoveMovedEvent: 1 | insupport: {0} | cursupchan: {1} | oldchan: {2}".format(self.insupport,self.cursupchan, self.oldchan))
            if self.debug: ts3lib.printMessageToCurrentTab("{0} {1} {2}".format(ownchan, self.afkchan, afk))
            if self.insupport == 0 and moverUniqueIdentifier == self.supbot and newChannelID == self.supchanmain and not ownchan == self.afkchan and not afk:
                for c in self.supchans:
                    (error, clients) = ts3lib.getChannelClientList(schid, c)
                    if len(clients) > 0: continue
                    else:
                        # ts3lib.sendPluginCommand(schid, "S3NDuZ3r", ts3defines.PluginMessageTarget.PLUGIN_MESSAGE_TARGET_SERVER, targetIDs, returnCode)
                        for ch in self.supchans:
                            (error, clients) = ts3lib.getChannelClientList(schid, ch)
                            if clientID in clients: return

                        ts3lib.requestClientMove(schid, clientID, c, "")
                        ts3lib.requestClientMove(schid, ownid, c, "")
                        (error, muted) = ts3lib.getClientVariableAsInt(schid, ownid, ts3defines.ClientProperties.CLIENT_OUTPUT_MUTED)
                        self.wasmuted = muted
                        ts3lib.setClientSelfVariableAsInt(schid, ts3defines.ClientProperties.CLIENT_OUTPUT_MUTED, 0);ts3lib.flushClientSelfUpdates(schid)
                        self.insupport = clientID;self.cursupchan = c;self.oldchan = ownchan
                        if self.debug: ts3lib.printMessageToCurrentTab("Now in support with client #{0} in channel #{1}".format(clientID, c))
                        return
                ts3lib.printMessageToCurrentTab("No free support channel found for client #{0}! Please try manually.".format(clientID))
            elif self.insupport == clientID and oldChannelID == self.cursupchan and moverID == ownid:
                if self.wasmuted: ts3lib.setClientSelfVariableAsInt(schid, ts3defines.ClientProperties.CLIENT_OUTPUT_MUTED, 1);ts3lib.flushClientSelfUpdates(schid)
                ts3lib.requestClientMove(schid, ownid, self.oldchan, "")
                ts3lib.printMessageToCurrentTab("Not longer in support with client #{0} in channel #{1}".format(self.insupport, self.cursupchan))
                self.insupport = 0;self.cursupchan = 0;self.oldchan = 0
            if self.debug: ts3lib.printMessageToCurrentTab("onClientMoveMovedEvent: 2 | insupport: {0} | cursupchan: {1} | oldchan: {2}".format(self.insupport,self.cursupchan, self.oldchan))
        except:
            try: from traceback import format_exc;ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "PyTSon", 0);pass
            except:
                try: from traceback import format_exc;ts3lib.printMessageToCurrentTab(format_exc())
                except:
                    try: from traceback import format_exc;print(format_exc())
                    except: print("Unknown Error")
Ejemplo n.º 26
0
 def moveBack(self):
     ts3lib.requestClientMove(self.schid, self.clid, self.cid, self.cpw)
Ejemplo n.º 27
0
 def commandBack(self, schid, targetMode, toID, fromID, params=""):
     (error, ownID) = ts3lib.getClientID(schid)
     ts3lib.requestClientMove(schid, ownID, self.oldChannelID, "123")
     if self.cfg.getboolean("general", "debug"): ts3lib.printMessageToCurrentTab("self.oldChannelID: {0}".format(self.oldChannelID))
Ejemplo n.º 28
0
 def commandJoin(self, schid, targetMode, toID, fromID, params=""):
     (error, target) = ts3lib.getChannelOfClient(schid, fromID)
     (error, ownID) = ts3lib.getClientID(schid)
     (error, ownChan) = ts3lib.getChannelOfClient(schid, ownID)
     if not ownChan == target: ts3lib.requestClientMove(schid, ownID, target, "123")
Ejemplo n.º 29
0
 def onMenuItemEvent(self, schid, atype, menuItemID, selectedItemID):
     try:
         if atype == ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_GLOBAL:
             if menuItemID == 1: # Message all Clients
                 (error, clients) = ts3lib.getClientList(schid)
                 msgs = self.getText(multiline=True,title="Message all %s clients on this server"%len(clients),text="Enter Private Message")
                 if bool(self.ok) != True:return
                 (error, ownID) = ts3lib.getClientID(schid)
                 for c in clients:
                     if c == ownID: continue
                     for msg in msgs: ts3lib.requestSendPrivateTextMsg(schid, msg, c)
             elif menuItemID == 2: # OffineMessage all Clients
                 (error, clients) = ts3lib.getClientList(schid)
                 (error, ownID) = ts3lib.getClientID(schid)
                 uids = []
                 for c in clients:
                     if c == ownID: continue
                     (error, uid) = ts3lib.getClientVariableAsString(schid, c, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
                     uids.append(uid)
                 if not self.dlg: self.dlg = MessageDialog(schid, uids)
                 self.dlg.show();self.dlg.raise_();self.dlg.activateWindow()
             elif menuItemID == 3: # Message all Channels
                 (error, channels) = ts3lib.getChannelList(schid)
                 msgs = self.getText(multiline=True,title="Message all %s channels on this server"%len(channels),text="Enter Channel Message")
                 (error, ownID) = ts3lib.getClientID(schid)
                 for c in channels:
                     error = ts3lib.requestClientMove(schid, ownID, c, "123")
                     if not error == ts3defines.ERROR_ok: continue
                     for msg in msgs: ts3lib.requestSendChannelTextMsg(schid, msg, c)
             elif menuItemID == 4: # Poke all Clients
                 (error, clients) = ts3lib.getClientList(schid)
                 msgs = self.getText(title="Poke all %s clients on this server"%len(clients),text="Enter Poke Message",max=100)
                 if bool(self.ok) != True:return
                 (error, ownID) = ts3lib.getClientID(schid)
                 for c in clients:
                     if c == ownID: continue
                     for msg in msgs: ts3lib.requestClientPoke(schid, c, msg)
             elif menuItemID == 5: # ChannelKick all Clients
                 (error, clients) = ts3lib.getClientList(schid)
                 msg = self.getText(title="Kick all %s clients on this server from their channel"%len(clients),text="Enter Kick Reason",multimsg=False,max=80)
                 if bool(self.ok) != True:return
                 (error, ownID) = ts3lib.getClientID(schid)
                 for c in clients:
                     if c == ownID: continue
                     ts3lib.requestClientKickFromChannel(schid, c, msg)
             elif menuItemID == 6: # ChannelBan all Clients
                 (error, clients) = ts3lib.getClientList(schid)
                 msg = self.getText(title="ChannelBan all %s clients on this server"%len(clients),text="Enter Kick Reason",multimsg=False,max=80)
                 if bool(self.ok) != True:return
                 (error, ownID) = ts3lib.getClientID(schid)
                 for c in clients:
                     if c == ownID: continue
                     (error, chan) = ts3lib.getChannelOfClient(schid, selectedItemID)
                     (error, dbid) = ts3lib.getClientVariableAsUInt64(schid, c, ts3defines.ClientPropertiesRare.CLIENT_DATABASE_ID)
                     ts3lib.requestSetClientChannelGroup(schid, [self.sbgroup], [chan], [dbid])
                     ts3lib.requestClientKickFromChannel(schid, c, msg)
             elif menuItemID == 7: # Kick all Clients
                 (error, clients) = ts3lib.getClientList(schid)
                 msg = self.getText(title="Kick all %s clients from this server"%len(clients),text="Enter Kick Reason",multimsg=False,max=80)
                 if bool(self.ok) != True:return
                 (error, ownID) = ts3lib.getClientID(schid)
                 for c in clients:
                     if c == ownID: continue
                     ts3lib.requestClientKickFromServer(schid, c, msg)
             elif menuItemID == 8: # Ban all Clients
                 (error, clients) = ts3lib.getClientList(schid)
                 msg = self.getText(title="Ban all %s clients from this server"%len(clients),text="Enter Ban Reason",multimsg=False,max=80)
                 if bool(self.ok) != True:return
                 (error, ownID) = ts3lib.getClientID(schid)
                 for c in clients:
                     if c == ownID: continue
                     ts3lib.banclient(schid, c, -1, msg)
             elif menuItemID == 9: # Delete all Channels
                 (error, channels) = ts3lib.getChannelList(schid)
                 confirmation = self.confirm('Delete all Channels', 'Do you really want to delete all {0} channels on this server?'.format(len(channels)))
                 if not confirmation: return
                 for c in channels: ts3lib.requestChannelDelete(schid, c, True)
         elif atype == ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_CHANNEL:
             if menuItemID == 1: # Message all Clients
                 (error, clients) = ts3lib.getChannelClientList(schid, selectedItemID)
                 (err, name) = ts3lib.getChannelVariableAsString(schid, selectedItemID, ts3defines.ChannelProperties.CHANNEL_NAME)
                 msgs = self.getText(multiline=True,title="Message to all %s clients in channel \"%s\""%(len(clients),name),text="Enter Private Message")
                 if bool(self.ok) != True:return
                 (error, ownID) = ts3lib.getClientID(schid)
                 for c in clients:
                     if c == ownID: continue
                     for msg in msgs: ts3lib.requestSendPrivateTextMsg(schid, msg, c)
             if menuItemID == 2: # OfflineMessage all Clients
                 (error, clients) = ts3lib.getChannelClientList(schid, selectedItemID)
                 (error, ownID) = ts3lib.getClientID(schid)
                 uids = []
                 for c in clients:
                     if c == ownID: continue
                     (error, uid) = ts3lib.getClientVariableAsString(schid, c, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
                     uids.append(uid)
                 if not self.dlg: self.dlg = MessageDialog(schid, uids)
                 self.dlg.show();self.dlg.raise_();self.dlg.activateWindow()
             elif menuItemID == 3: # Poke all Clients
                 (error, clients) = ts3lib.getChannelClientList(schid, selectedItemID)
                 (err, name) = ts3lib.getChannelVariableAsString(schid, selectedItemID, ts3defines.ChannelProperties.CHANNEL_NAME)
                 msgs = self.getText(title="Poke all %s clients in channel \"%s\""%(len(clients),name),text="Enter Poke Message",max=100)
                 if bool(self.ok) != True:return
                 (error, ownID) = ts3lib.getClientID(schid)
                 for c in clients:
                     if c == ownID: continue
                     for msg in msgs: ts3lib.requestClientPoke(schid, c, msg)
             elif menuItemID == 4: # ChannelKick all Clients
                 (error, clients) = ts3lib.getChannelClientList(schid,selectedItemID)
                 (err, name) = ts3lib.getChannelVariableAsString(schid, selectedItemID, ts3defines.ChannelProperties.CHANNEL_NAME)
                 msg = self.getText(title="Kick all %s clients from channel \"%s\""%(len(clients),name),text="Enter Kick Reason",multimsg=False,max=80)
                 if bool(self.ok) != True:return
                 (error, ownID) = ts3lib.getClientID(schid)
                 for c in clients:
                     if c == ownID: continue
                     ts3lib.requestClientKickFromChannel(schid, c, msg)
             elif menuItemID == 5: # ChannelBan all Clients
                 (error, clients) = ts3lib.getChannelClientList(schid,selectedItemID)
                 (err, name) = ts3lib.getChannelVariableAsString(schid, selectedItemID, ts3defines.ChannelProperties.CHANNEL_NAME)
                 msg = self.getText(title="ChannelBan all %s clients from channel \"%s\""%(len(clients),name),text="Enter Kick Reason",multimsg=False,max=80)
                 if bool(self.ok) != True:return
                 (error, ownID) = ts3lib.getClientID(schid)
                 for c in clients:
                     if c == ownID: continue
                     (error, dbid) = ts3lib.getClientVariableAsUInt64(schid, c, ts3defines.ClientPropertiesRare.CLIENT_DATABASE_ID)
                     ts3lib.requestSetClientChannelGroup(schid, [self.sbgroup], [selectedItemID], [dbid])
                     ts3lib.requestClientKickFromChannel(schid, c, msg)
             elif menuItemID == 6: # Kick all Clients
                 (error, clients) = ts3lib.getChannelClientList(schid,selectedItemID)
                 (err, name) = ts3lib.getChannelVariableAsString(schid, selectedItemID, ts3defines.ChannelProperties.CHANNEL_NAME)
                 msg = self.getText(title="Kick all %s clients in channel \"%s\" from this server"%(len(clients),name),text="Enter Kick Reason",multimsg=False,max=80)
                 if bool(self.ok) != True:return
                 (error, ownID) = ts3lib.getClientID(schid)
                 for c in clients:
                     if c == ownID: continue
                     ts3lib.requestClientKickFromServer(schid, c, msg)
             elif menuItemID == 7: # Ban all Clients
                 (error, clients) = ts3lib.getChannelClientList(schid,selectedItemID)
                 (err, name) = ts3lib.getChannelVariableAsString(schid, selectedItemID, ts3defines.ChannelProperties.CHANNEL_NAME)
                 msg = self.getText(title="Ban all %s clients in channel \"%s\""%(len(clients),name),text="Enter Ban Reason",multimsg=False,max=80)
                 if bool(self.ok) != True:return
                 (error, ownID) = ts3lib.getClientID(schid)
                 for c in clients:
                     if c == ownID: continue
                     ts3lib.banclient(schid, c, -1, msg)
     except: from traceback import format_exc;ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "pyTSon", 0)
Ejemplo n.º 30
0
 def onHotkeyOrCommandEvent(self, keyword, schid=0):
     try:
         if not schid: schid = ts3lib.getCurrentServerConnectionHandlerID()
         if keyword == "test":
             msg = [
                 "moveBeforeBan", self.moveBeforeBan, "sgids", self.sgids,
                 "lastchans", self.lastchans, "last_joined_server",
                 self.last_joined_server, "last_joined_channel",
                 self.last_joined_channel, "last_talk_power",
                 self.last_talk_power, "requested", self.requested,
                 "requestedIP", self.requestedIP, "retcode", self.retcode
             ]
             print(msg)
             ts3lib.printMessageToCurrentTab(' '.join(str(x) for x in msg))
         elif keyword == "restrict_last_joined_server":
             self.requested = self.last_joined_server
             msg = self.cfg.get("restrict", "poke")
             if msg: ts3lib.requestClientPoke(schid, self.requested, msg)
             ts3lib.requestClientVariables(schid, self.last_joined_server)
             # self.restrictClient(schid, self.last_joined_server)
         elif keyword == "restrict_last_joined_channel":
             self.requested = self.last_joined_channel
             msg = self.cfg.get("restrict", "poke")
             if msg: ts3lib.requestClientPoke(schid, self.requested, msg)
             ts3lib.requestClientVariables(schid, self.last_joined_channel)
             # self.restrictClient(schid, self.last_joined_channel)
         elif keyword == "ban_last_joined_server":
             msg = self.cfg.get("ban", "poke")
             if msg:
                 ts3lib.requestClientPoke(schid, self.last_joined_server,
                                          msg)
             self.banClient(schid, self.last_joined_server)
         elif keyword == "ban_last_joined_channel":
             msg = self.cfg.get("ban", "poke")
             if msg:
                 ts3lib.requestClientPoke(schid, self.last_joined_channel,
                                          msg)
             self.banClient(schid, self.last_joined_channel)
         elif keyword == "revoke_last_talk_power_channel":
             self.revokeTalkPower(schid, self.last_talk_power)
         elif keyword == "restrict_last_joined_channel_from_local_channels":
             self.restrictForeigners(schid, self.last_joined_channel)
         elif keyword == "last_joined_channel_to_customBan":
             self.toCustomBan(schid, self.last_joined_channel)
         elif keyword == "last_joined_server_to_customBan":
             self.toCustomBan(schid, self.last_joined_server)
         elif keyword == "selected_to_customBan":
             window = self.app.activeWindow()
             if window is None or not window.className() == "MainWindow":
                 return
             selected = widget("ServerTreeView", self.app).currentIndex()
             if not selected: return
             name = selected.data()
             item = getIDByName(name, schid)
             if item[1] != ServerTreeItemType.CLIENT:
                 ts3lib.playWaveFile(schid,
                                     path.join(self.path, "error.wav"))
                 ts3lib.printMessageToCurrentTab(
                     "{}: [color=red]No client with name[/color] {} [color=red]found![/color]"
                     .format(self.name, name))
                 return
             self.toCustomBan(schid, item[0])
         elif keyword == "join_selected_channel_pw":
             window = self.app.activeWindow()
             if window is None or not window.className() == "MainWindow":
                 return
             selected = widget("ServerTreeView", self.app).currentIndex()
             if not selected: return
             name = selected.data()
             item = getIDByName(name, schid)
             if item[1] != ServerTreeItemType.CHANNEL: return
             (err, clid) = ts3lib.getClientID(schid)
             (err, cid) = ts3lib.getChannelOfClient(schid, clid)
             if cid == item[0]: return
             pw = getChannelPassword(schid, item[0], calculate=True)
             if not pw: return
             # ts3lib.printMessageToCurrentTab("{} > Joining {} (pw: {})".format(self.name, name, pw))
             ts3lib.requestClientMove(schid, clid, item[0], pw)
         elif keyword == "rejoin_last_channel_pw":
             (err, clid) = ts3lib.getClientID(schid)
             (err, cid) = ts3lib.getChannelOfClient(schid, clid)
             tcid = self.lastchans[schid]
             if cid == tcid: return
             pw = getChannelPassword(schid, tcid, calculate=True)
             # (err, name) = ts3lib.getChannelVariable(schid, tcid, ts3defines.ChannelProperties.CHANNEL_NAME)
             # ts3lib.printMessageToCurrentTab("{} > Rejoining {} (pw: {})".format(self.name, name, pw))
             ts3lib.requestClientMove(schid, clid, tcid,
                                      pw if pw else "123")
     except:
         print("error")
         ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR,
                           "pyTSon", 0)
     return True