Example #1
0
 def onUpdateClientEvent(self, schid, clid, invokerID, invokerName,
                         invokerUniqueIdentifier):
     (err, ownID) = ts3lib.getClientID(schid)
     (err, cid) = ts3lib.getChannelOfClient(schid, clid)
     (err, ownCID) = ts3lib.getChannelOfClient(schid, ownID)
     (err, talker) = ts3lib.getClientVariable(
         schid, clid, ts3defines.ClientPropertiesRare.CLIENT_IS_TALKER)
     if cid == ownCID and talker: self.last_talk_power = clid
     if clid == self.requested:
         self.requested = 0
         if talker == 1: self.revokeTalkPower(schid, clid, True)
         # else: self.revokeTalkPower(schid, clid, False)
         (err, cldbid) = ts3lib.getClientVariable(
             schid, clid,
             ts3defines.ClientPropertiesRare.CLIENT_DATABASE_ID)
         (err, sgids) = ts3lib.getClientVariable(
             schid, clid,
             ts3defines.ClientPropertiesRare.CLIENT_SERVERGROUPS)
         loc_sgids = intList(self.cfg.get("restrict", "sgids"))
         if set(loc_sgids).issubset(sgids):
             for sgid in loc_sgids:
                 ts3lib.requestServerGroupDelClient(schid, sgid, cldbid)
         else:
             for sgid in loc_sgids:
                 ts3lib.requestServerGroupAddClient(schid, sgid, cldbid)
Example #2
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])
Example #3
0
 def onClientMoveEvent(self, schid, clid, oldChannelID, newChannelID,
                       visibility, moveMessage):
     if schid != ts3lib.getCurrentServerConnectionHandlerID(): return
     (err, ownID) = ts3lib.getClientID(schid)
     if clid == ownID: return
     (err, sgids) = ts3lib.getClientVariableAsString(
         schid, clid, ts3defines.ClientPropertiesRare.CLIENT_SERVERGROUPS)
     if sgids is not None:
         sgids = intList(sgids)
         if not any(x in sgids for x in self.sgids): return
     if oldChannelID == 0: self.last_joined_server = clid
     (err, ownCID) = ts3lib.getChannelOfClient(schid, ownID)
     if newChannelID == ownCID: self.last_joined_channel = clid
Example #4
0
 def restrictForeigners(self, schid, clid):
     (err, cldbid) = ts3lib.getClientVariable(
         schid, clid, ts3defines.ClientPropertiesRare.CLIENT_DATABASE_ID)
     (err, sgids) = ts3lib.getClientVariable(
         schid, clid, ts3defines.ClientPropertiesRare.CLIENT_SERVERGROUPS)
     loc_sgids = intList(self.cfg.get("restrict local", "sgids"))
     loc_cids = intList(self.cfg.get("restrict local", "cids"))
     if sgids and set(loc_sgids).issubset(sgids):
         for sgid in loc_sgids:
             ts3lib.requestServerGroupDelClient(schid, sgid, cldbid)
         (err, dcgid) = ts3lib.getServerVariable(
             schid, ts3defines.VirtualServerPropertiesRare.
             VIRTUALSERVER_DEFAULT_CHANNEL_GROUP)
         ts3lib.requestSetClientChannelGroup(schid, [dcgid] * len(loc_cids),
                                             loc_cids,
                                             [cldbid] * len(loc_cids))
         return
     for sgid in loc_sgids:
         ts3lib.requestServerGroupAddClient(schid, sgid, cldbid)
     ts3lib.requestSetClientChannelGroup(
         schid, [self.cfg.getint("restrict local", "cgid")] * len(loc_cids),
         loc_cids, [cldbid] * len(loc_cids))
     msg = self.cfg.get("restrict local", "poke")
     if msg: ts3lib.requestClientPoke(schid, self.last_joined_channel, msg)
Example #5
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])
Example #6
0
 def onClientKickFromChannelEvent(self, schid, clientID, oldChannelID,
                                  newChannelID, visibility, kickerID,
                                  kickerName, kickerUniqueIdentifier,
                                  kickMessage):
     (err, ownID) = ts3lib.getClientID(schid)
     if clientID != ownID or kickerID == ownID: return
     (err, sgids) = ts3lib.getClientVariableAsString(
         schid, clientID,
         ts3defines.ClientPropertiesRare.CLIENT_SERVERGROUPS)
     sgids = intList(sgids)
     if any(i in sgids for i in self.whitelistSGIDs): return
     (err, uid) = ts3lib.getClientVariable(
         schid, clientID,
         ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
     if uid in self.whitelistUIDs: return
     self.pw = getChannelPassword(schid, oldChannelID)
     # (err, cpath, self.cpw) = ts3lib.getChannelConnectInfo(schid, oldChannelID)
     self.schid = schid
     self.clid = ownID
     self.cid = oldChannelID
     if self.delay >= 0: QTimer.singleShot(self.delay, self.moveBack)
     else: self.moveBack()
def parseMessage(logMessage):
    log = intList(logMessage, ";")
    return log[0], log[1]
Example #8
0
 def onServerGroupClientDeletedEvent(self, schid, clid, clientName, clientUniqueIdentity, sgid, invokerClientID, invokerName, invokerUniqueIdentity):
     err, sgids = ts3lib.getClientVariableAsString(schid, clid, ts3defines.ClientPropertiesRare.CLIENT_SERVERGROUPS)
     print("Servergroups",sgids)
     sgids = intList(sgids)
     if any(x in self.sgids for x in sgids):
         print("true")