Ejemplo n.º 1
0
 def onClientMoveEvent(self, schid, clid, oldChannelID, newChannelID,
                       visibility, moveMessage):
     if not newChannelID: return
     srv = self.ts3host.getServer(schid)
     if clid == srv.me.clientID:
         self.clients = {}
         (err, clids) = ts3lib.getChannelClientList(schid, newChannelID)
         for clid in clids:
             if clid == srv.me.clientID: continue
             self.onClientMoveEvent(schid, clid, 0,
                                    srv.me.channel.channelID,
                                    ts3defines.Visibility.ENTER_VISIBILITY,
                                    "")
         return
     if not srv.me.channel.channelID in [newChannelID, oldChannelID]: return
     # if not srv.me.getChannelGroupId() in [self.tabs[schid]["channelModGroup"],srv.defaultChannelAdminGroup]: return
     # (err, perm) = ts3lib.getClientNeededPermission(schid, "b_client_set_flag_talker")
     # if not perm: return
     if newChannelID == srv.me.channel.channelID:
         client = srv.getUser(clid)
         if client.getChannelGroupId() != srv.defaultChannelGroup: return
         status = getContactStatus(srv.me.uid)
         if status == ContactStatus.FRIEND: return
         self.clients[clid] = 0
     elif oldChannelID == srv.me.channel.channelID:
         if clid in self.clients: del self.clients[clid]
Ejemplo n.º 2
0
 def onClientMoveEvent(self, schid, clientID, oldChannelID, newChannelID,
                       visibility, moveMessage):
     if not self.askForAvatar: return
     (err, suid) = ts3lib.getServerVariable(
         schid,
         ts3defines.VirtualServerProperties.VIRTUALSERVER_UNIQUE_IDENTIFIER)
     if suid != self.suid: return
     if oldChannelID != 0: return
     (err, uid) = ts3lib.getClientVariable(
         schid, clientID,
         ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
     if getContactStatus(uid) == ContactStatus.BLOCKED: return
     if uid in self.alreadyAsked: return
     (err, sgroups) = ts3lib.getClientVariableAsString(
         schid, clientID,
         ts3defines.ClientPropertiesRare.CLIENT_SERVERGROUPS)
     sgroups = sgroups.split(",")
     if self.ruheGroupID in sgroups: return
     if set(sgroups).isdisjoint(self.premiumGroupIDs): return
     (err, myuid) = ts3lib.getClientSelfVariable(
         schid, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
     (err, nick) = ts3lib.getClientVariable(
         schid, clientID, ts3defines.ClientProperties.CLIENT_NICKNAME)
     ts3lib.requestSendPrivateTextMsg(
         schid,
         self.avatarmsg.replace("{nick}",
                                nick).replace("{myuid}",
                                              myuid).replace("{uid}", uid),
         clientID)
     self.alreadyAsked.append(uid)
Ejemplo n.º 3
0
 def onMenuItemEvent(self, schid, atype, menuItemID, selectedItemID):
     if atype == ts3defines.PluginItemType.PLUGIN_SERVER:
         if menuItemID == 0:
             self.dynamicSilence = not self.dynamicSilence
             ts3lib.printMessageToCurrentTab(
                 "{}{}: DynamicSilence set to [color=orange]{}".format(
                     timestamp(), self.name, self.dynamicSilence))
         elif menuItemID == 1:
             self.askForAvatar = not self.askForAvatar
             ts3lib.printMessageToCurrentTab(
                 "{}askForAvatar set to [color=orange]{}".format(
                     timestamp(), self.askForAvatar))
             if not self.askForAvatar:
                 self.clids = []
                 self.timer.stop()
                 return
             (err, clids) = ts3lib.getClientList(schid)
             for c in clids:
                 ts3lib.requestClientVariables(schid, c)
             for c in clids:
                 (err, uid) = ts3lib.getClientVariable(
                     schid, c,
                     ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
                 if getContactStatus(uid) == ContactStatus.BLOCKED: continue
                 if uid in self.alreadyAsked: continue
                 (err, sgroups) = ts3lib.getClientVariableAsString(
                     schid, c,
                     ts3defines.ClientPropertiesRare.CLIENT_SERVERGROUPS)
                 sgroups = sgroups.split(",")
                 if self.ruheGroupID in sgroups: continue
                 if set(sgroups).isdisjoint(self.premiumGroupIDs): continue
                 self.clids.append(c)
             ts3lib.printMessageToCurrentTab(
                 "{}Asking {} clients for avatar".format(
                     timestamp(), len(self.clids)))
             self.schid = schid
             self.timer.start(1000)
     if atype == ts3defines.PluginItemType.PLUGIN_CHANNEL:
         ts3lib.requestSendChannelTextMsg(schid, self.steammsg,
                                          selectedItemID)
     elif atype == ts3defines.PluginItemType.PLUGIN_CLIENT:
         if menuItemID == 0:
             ts3lib.requestSendPrivateTextMsg(schid, self.steammsg,
                                              selectedItemID)
         elif menuItemID == 1:
             print(self.aka)
             if self.aka != (0, 0, "", ""):
                 self.aka = (0, 0, "", "")
                 return
             realname = inputBox(self.name, "Real name:")
             if not realname: return
             (err, name) = ts3lib.getClientVariable(
                 schid, selectedItemID,
                 ts3defines.ClientProperties.CLIENT_NICKNAME)
             ts3lib.setClientSelfVariableAsString(
                 schid, ts3defines.ClientProperties.CLIENT_NICKNAME,
                 "{} aka {}".format(realname, name))
             ts3lib.flushClientSelfUpdates(schid)
             self.aka = (schid, selectedItemID, realname, name)
Ejemplo n.º 4
0
 def onClientMoveEvent(self, schid, clientID, oldChannelID, newChannelID, visibility, moveMessage):
     if not self.friend_autocommander: return
     if oldChannelID != 0: return # if newChannelID == 0: return
     (err, clid) = ts3lib.getClientID(schid)
     if clientID == clid: return
     (err, uid) = ts3lib.getClientVariable(schid, clientID, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
     if uid and uid.startswith("FakeClient"): return
     if getContactStatus(uid) != ContactStatus.FRIEND: return
     sendCommand(self.name, "notifyclientupdated clid={} client_is_channel_commander=1".format(clientID), schid, True, True) #  client_country=JP client_is_recording=1 client_platform=Windoof
Ejemplo n.º 5
0
 def onClientMoveEvent(self, schid, clientID, oldChannelID, newChannelID,
                       visibility, moveMessage):
     if not self.enabled: return
     if self.schid != schid: return
     if not self.mychan: return
     (err, suid) = ts3lib.getServerVariable(
         schid,
         ts3defines.VirtualServerProperties.VIRTUALSERVER_UNIQUE_IDENTIFIER)
     if suid != self.suid: return
     (err, ownID) = ts3lib.getClientID(schid)
     if clientID == ownID: return
     if clientID in self.waiting and (newChannelID == 0
                                      or newChannelID == self.mychan):
         # if newChannelID == self.mychan:
         # (err, dbid) = ts3lib.getClientVariable(schid, clientID, ts3defines.ClientPropertiesRare.CLIENT_DATABASE_ID)
         ts3lib.printMessage(
             schid, "{}: [color=orange]Removing channel mod from {}".format(
                 self.name, self.waiting[clientID]
                 if newChannelID == 0 else clientURL(schid, clientID)),
             ts3defines.PluginMessageTarget.PLUGIN_MESSAGE_TARGET_SERVER)
         ts3lib.requestSetClientChannelGroup(schid, [self.sgid_guest],
                                             [self.mychan],
                                             [self.waiting[clientID]])
         del self.waiting[clientID]
         return
     if newChannelID == 0 or oldChannelID != 0: return
     (err, sgids) = ts3lib.getClientVariableAsString(
         schid, clientID,
         ts3defines.ClientPropertiesRare.CLIENT_SERVERGROUPS)
     if not self.sgid_guest in intList(sgids): return
     # TODO Any way to get the cgid in another channel?
     (err, uid) = ts3lib.getClientVariable(
         schid, clientID,
         ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
     if getContactStatus(uid) == ContactStatus.BLOCKED:
         ts3lib.printMessage(
             schid,
             "{}: [color=red]Not allowing blocked user {} in your channel.".
             format(self.name, clientURL(schid, clientID)),
             ts3defines.PluginMessageTarget.PLUGIN_MESSAGE_TARGET_SERVER)
         return
     (err, dbid) = ts3lib.getClientVariable(
         schid, clientID,
         ts3defines.ClientPropertiesRare.CLIENT_DATABASE_ID)
     self.waiting[clientID] = dbid
     ts3lib.printMessage(
         schid,
         "{}:  [color=green]Found new guest {} giving him channel mod until he's here ;)"
         .format(self.name, clientURL(schid, clientID)),
         ts3defines.PluginMessageTarget.PLUGIN_MESSAGE_TARGET_SERVER)
     ts3lib.requestSetClientChannelGroup(schid, [self.cgid_mod],
                                         [self.mychan], [dbid])
Ejemplo n.º 6
0
 def onIncomingClientQueryEvent(self, schid, commandText):
     if not self.dynamicSilence: return
     (err, suid) = ts3lib.getServerVariable(schid, ts3defines.VirtualServerProperties.VIRTUALSERVER_UNIQUE_IDENTIFIER)
     if suid != self.suid: return
     if commandText.split(" ", 1)[0] != "notifyclientupdated": return
     cmd, params = parseCommand(commandText)
     if len(params) > 0 and "client_nickname" in params:
         clid = int(params["clid"])
         # (err, ownID) = ts3lib.getClientID(schid)
         # if clid == ownID: return
         (err, uid) = ts3lib.getClientVariable(schid, clid, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
         if getContactStatus(uid) != ContactStatus.FRIEND: return
         if not self.dynamicSilenceName in params["client_nickname"].lower(): return
         ts3lib.requestSendPrivateTextMsg(schid, "Yes, {}-{}?".format(clientURL(schid, clid), choice(["chan","san"])), clid)
Ejemplo n.º 7
0
 def onClientMoveEvent(self, schid, clid, oldChannelID, newChannelID,
                       visibility, moveMessage):
     client = self.ts3host.getUser(schid, clid)
     # if client.server.me.channel.cid == client.cid
     if not client.server.me.getChannelGroupId() in [
             self.tabs[schid]["channelModGroup"],
             client.server.defaultChannelAdminGroup
     ]:
         return
     if clid in self.waiting and (newChannelID == 0
                                  or newChannelID == self.mychan):
         # if newChannelID == self.mychan:
         # (err, dbid) = ts3lib.getClientVariable(schid, clientID, ts3defines.ClientPropertiesRare.CLIENT_DATABASE_ID)
         ts3lib.printMessage(
             schid, "{}: [color=orange]Removing channel mod from {}".format(
                 self.name, self.waiting[clid]
                 if newChannelID == 0 else clientURL(schid, clid)),
             ts3defines.PluginMessageTarget.PLUGIN_MESSAGE_TARGET_SERVER)
         ts3lib.requestSetClientChannelGroup(schid, [self.sgid_guest],
                                             [self.mychan],
                                             [self.waiting[clid]])
         del self.waiting[clid]
         return
     if newChannelID == 0 or oldChannelID != 0: return
     (err, sgids) = ts3lib.getClientVariableAsString(
         schid, clid, ts3defines.ClientPropertiesRare.CLIENT_SERVERGROUPS)
     if not self.sgid_guest in intList(sgids): return
     # TODO Any way to get the cgid in another channel?
     (err, uid) = ts3lib.getClientVariable(
         schid, clid, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
     if getContactStatus(uid) == ContactStatus.BLOCKED:
         ts3lib.printMessage(
             schid,
             "{}: [color=red]Not allowing blocked user {} in your channel.".
             format(self.name, clientURL(schid, clid)),
             ts3defines.PluginMessageTarget.PLUGIN_MESSAGE_TARGET_SERVER)
         return
     (err, dbid) = ts3lib.getClientVariable(
         schid, clid, ts3defines.ClientPropertiesRare.CLIENT_DATABASE_ID)
     self.waiting[clid] = dbid
     ts3lib.printMessage(
         schid,
         "{}:  [color=green]Found new guest {} giving him channel mod until he's here ;)"
         .format(self.name, clientURL(schid, clid)),
         ts3defines.PluginMessageTarget.PLUGIN_MESSAGE_TARGET_SERVER)
     ts3lib.requestSetClientChannelGroup(schid, [self.cgid_mod],
                                         [self.mychan], [dbid])
Ejemplo n.º 8
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.º 9
0
 def onTextMessageEvent(self, schid, targetMode, toID, fromID, fromName,
                        fromUniqueIdentifier, message, ffIgnored):
     if ffIgnored: return False
     if targetMode != ts3defines.TextMessageTargetMode.TextMessageTarget_CLIENT:
         return False
     err, ownID = ts3lib.getClientID(schid)
     if fromID == ownID: return False
     err, uid = ts3lib.getClientVariable(
         schid, fromID,
         ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
     if getContactStatus(uid) == ContactStatus.FRIEND: return False
     uid_encoded = b64encode(uid.encode()).decode()
     (err, suid) = ts3lib.getServerVariable(
         schid,
         ts3defines.VirtualServerProperties.VIRTUALSERVER_UNIQUE_IDENTIFIER)
     suid_encoded = b64encode(suid.encode()).decode()
     _path = path.join(ts3lib.getConfigPath(), "chats", suid_encoded,
                       "clients", uid_encoded)
     if PluginHost.cfg.getboolean("general", "verbose"):
         print(self.name, ">", "path:", _path)
     if path.exists("{}.html".format(_path)): return False
     if path.exists("{}.txt".format(_path)): return False
     return True