Example #1
0
 def importChannels(self, schid, file=""):
     self.result = {
         "success": 0,
         "failed": 0,
         "total": 0,
         "msg": "",
         "stop": False
     }
     channels = self.readChannels(file)
     self.result["total"] = len(channels)
     for channel in channels:
         if self.result["stop"]:
             self.result["stop"] = False
             return
         for k, v in channel["flags"].items():
             ts3lib.setChannelVariableAsString(schid, 0, k, v)
             print("Setting var", k, "with value", v)
         returnCode = ts3lib.createReturnCode()
         # result = {}
         self.channels.append({
             returnCode: (channel["flags"][ChannelProperties.CHANNEL_NAME],
                          channel["permissions"])
         })
         self.channels.append(channel)
         ts3lib.flushChannelCreation(schid, 0, returnCode)
Example #2
0
 def onMenuItemEvent(self, schid, atype, menuItemID, selectedItemID):
     if atype != ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_GLOBAL: return
     if menuItemID == 0: pass
     elif menuItemID == 1:
         ts3lib.setChannelVariableAsString(
             schid, 0, ts3defines.ChannelProperties.CHANNEL_NAME, "test")
         ts3lib.flushChannelCreation(schid, 0)
Example #3
0
 def createChannel(self, schid):
     ts3lib.setChannelVariableAsString(
         schid, 0, ts3defines.ChannelProperties.CHANNEL_NAME,
         self.chan.get("props", "name open"))
     ts3lib.setChannelVariableAsInt(
         schid, 0, ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS,
         self.chan.getint("props", "maxclients"))
     ts3lib.setChannelVariableAsInt(
         schid, 0, ts3defines.ChannelProperties.CHANNEL_CODEC,
         self.chan.getint("props", "codec"))
     ts3lib.setChannelVariableAsInt(
         schid, 0, ts3defines.ChannelProperties.CHANNEL_CODEC_QUALITY,
         self.chan.getint("props", "codec_quality"))
     ts3lib.setChannelVariableAsString(
         schid, 0, ts3defines.ChannelProperties.CHANNEL_DESCRIPTION,
         self.description)
     ts3lib.setChannelVariableAsInt(
         schid, 0, ts3defines.ChannelProperties.CHANNEL_FLAG_SEMI_PERMANENT,
         1)
     ts3lib.setChannelVariableAsInt(
         schid, 0,
         ts3defines.ChannelPropertiesRare.CHANNEL_FLAG_MAXCLIENTS_UNLIMITED,
         0)
     ts3lib.setChannelVariableAsInt(
         schid, 0,
         ts3defines.ChannelPropertiesRare.CHANNEL_NEEDED_TALK_POWER, 1337)
     print(self.schids)
     print(self.schids[schid])
     return
     ts3lib.flushChannelCreation(schid, self.schids[schid])
     self.waitforchannel = True
Example #4
0
    def fakeChannel(self, schid, channelID):
        err, ownID = ts3lib.getClientID(schid)
        err, ownCID = ts3lib.getChannelOfClient(schid, ownID)
        # channel = self.ts3host.getChannel(schid, channelID)
        (error, name) = ts3lib.getChannelVariable(
            schid, channelID, ts3defines.ChannelProperties.CHANNEL_NAME)
        # name = name.encode("utf-8").decode(sys.stdout.encoding)
        if not error and name:
            ts3lib.setChannelVariableAsString(
                schid, ownCID, ts3defines.ChannelProperties.CHANNEL_NAME,
                self.str_replace(name))
        """
        (error, phonetic) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelPropertiesRare.CHANNEL_NAME_PHONETIC)
        if debug: print("err:", error, "CHANNEL_NAME_PHONETIC", phonetic)
        if not error and phonetic: ts3lib.setChannelVariableAsString(schid, 0,ts3defines.ChannelPropertiesRare.CHANNEL_NAME_PHONETIC,phonetic)

        (error, pw) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelProperties.CHANNEL_FLAG_PASSWORD)
        if debug: print("err:", error, "CHANNEL_FLAG_PASSWORD", pw)
        if pw:
            (err, path, _pw) = ts3lib.getChannelConnectInfo(schid, channelID)
            if debug: print("err:", error, "_pw", _pw)
            ts3lib.setChannelVariableAsString(schid, 0,ts3defines.ChannelProperties.CHANNEL_PASSWORD,_pw if _pw else ".")
        """
        """
        (error, topic) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelProperties.CHANNEL_TOPIC)
        if debug: print("err:", error, "CHANNEL_TOPIC", topic)
        if not error and topic: ts3lib.setChannelVariableAsString(schid, 0,ts3defines.ChannelProperties.CHANNEL_TOPIC,topic)

        ts3lib.requestChannelDescription(schid, channelID)
        (error, description) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelProperties.CHANNEL_DESCRIPTION)
        if debug: print("err:", error, "CHANNEL_DESCRIPTION", description)
        if not error and description: ts3lib.setChannelVariableAsString(schid, 0,ts3defines.ChannelProperties.CHANNEL_DESCRIPTION,description.decode('utf-8'))
        """
        """
        (error, neededtp) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelPropertiesRare.CHANNEL_NEEDED_TALK_POWER)
        if debug: print("err:", error, "CHANNEL_NEEDED_TALK_POWER", neededtp)
        if not error and neededtp: ts3lib.setChannelVariableAsInt(schid, 0,ts3defines.ChannelPropertiesRare.CHANNEL_NEEDED_TALK_POWER,neededtp)

        (error, codec) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelProperties.CHANNEL_CODEC)
        if debug: print("err:", error, "CHANNEL_CODEC", codec)
        if not error and codec: ts3lib.setChannelVariableAsInt(schid, 0,ts3defines.ChannelProperties.CHANNEL_CODEC,codec)

        (error, quality) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelProperties.CHANNEL_CODEC_QUALITY)
        if debug: print("err:", error, "CHANNEL_CODEC_QUALITY", quality)
        if not error and quality: ts3lib.setChannelVariableAsInt(schid, 0,ts3defines.ChannelProperties.CHANNEL_CODEC_QUALITY,quality)

        (error, latency) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelProperties.CHANNEL_CODEC_LATENCY_FACTOR)
        if debug: print("err:", error, "CHANNEL_CODEC_LATENCY_FACTOR", latency)
        if not error and latency: ts3lib.setChannelVariableAsInt(schid, 0,ts3defines.ChannelProperties.CHANNEL_CODEC_LATENCY_FACTOR,latency)

        (error, unencrypted) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelProperties.CHANNEL_CODEC_IS_UNENCRYPTED)
        if debug: print("err:", error, "CHANNEL_CODEC_IS_UNENCRYPTED", unencrypted)
        if not error and unencrypted: ts3lib.setChannelVariableAsInt(schid, 0,ts3defines.ChannelProperties.CHANNEL_CODEC_IS_UNENCRYPTED,unencrypted)

        (error, maxclients) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS)
        if debug: print("err:", error, "CHANNEL_MAXCLIENTS", maxclients)
        if not error and maxclients: ts3lib.setChannelVariableAsInt(schid, 0,ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS,maxclients)

        (error, maxfamilyclients) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelProperties.CHANNEL_MAXFAMILYCLIENTS)
        if debug: print("err:", error, "CHANNEL_MAXFAMILYCLIENTS", maxfamilyclients)
        if not error and maxfamilyclients: ts3lib.setChannelVariableAsInt(schid, 0,ts3defines.ChannelProperties.CHANNEL_MAXFAMILYCLIENTS,maxfamilyclients)

        (error, iconid) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelPropertiesRare.CHANNEL_ICON_ID)
        if debug: print("err:", error, "CHANNEL_ICON_ID", iconid)
        if not error and iconid: ts3lib.setChannelVariableAsInt(schid, 0,ts3defines.ChannelPropertiesRare.CHANNEL_ICON_ID,iconid)
        """
        self.retcode = ts3lib.createReturnCode()
        err = ts3lib.flushChannelUpdates(schid, ownCID, self.retcode)
        _err, errmsg = ts3lib.getErrorMessage(err)
        print("ts3lib.flushChannelUpdates", "schid:", schid, "ownID:", ownID,
              "ownCID:", ownCID, "retcode", self.retcode, "err", err, "errmsg",
              errmsg)
        if err == ts3defines.ERROR_ok: return
        err = ts3lib.flushChannelCreation(schid, 0, self.retcode)
        _err, errmsg = ts3lib.getErrorMessage(err)
        print("ts3lib.flushChannelCreation", "schid:", schid, "0", "retcode",
              self.retcode, "err", err, "errmsg", errmsg)
Example #5
0
    def fakeChannel(self, schid, channelID):
        channel = self.ts3host.getChannel(schid, channelID)
        debug = PluginHost.cfg.getboolean("general", "verbose")
        (error, name) = ts3lib.getChannelVariable(
            schid, channelID, ts3defines.ChannelProperties.CHANNEL_NAME)
        name = name.encode("utf-8").decode(sys.stdout.encoding)
        # TODO MODIFY NAME
        if debug: print("err:", error, "CHANNEL_NAME", name)
        if not error and name:
            ts3lib.setChannelVariableAsString(
                schid, 0, ts3defines.ChannelProperties.CHANNEL_NAME, name)

        (error, phonetic) = ts3lib.getChannelVariable(
            schid, channelID,
            ts3defines.ChannelPropertiesRare.CHANNEL_NAME_PHONETIC)
        if debug: print("err:", error, "CHANNEL_NAME_PHONETIC", phonetic)
        if not error and phonetic:
            ts3lib.setChannelVariableAsString(
                schid, 0,
                ts3defines.ChannelPropertiesRare.CHANNEL_NAME_PHONETIC,
                phonetic)

        (error, pw) = ts3lib.getChannelVariable(
            schid, channelID,
            ts3defines.ChannelProperties.CHANNEL_FLAG_PASSWORD)
        if debug: print("err:", error, "CHANNEL_FLAG_PASSWORD", pw)
        if pw:
            (err, path, _pw) = ts3lib.getChannelConnectInfo(schid, channelID)
            if debug: print("err:", error, "_pw", _pw)
            ts3lib.setChannelVariableAsString(
                schid, 0, ts3defines.ChannelProperties.CHANNEL_PASSWORD,
                _pw if _pw else ".")
        """
        (error, topic) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelProperties.CHANNEL_TOPIC)
        if debug: print("err:", error, "CHANNEL_TOPIC", topic)
        if not error and topic: ts3lib.setChannelVariableAsString(schid, 0,ts3defines.ChannelProperties.CHANNEL_TOPIC,topic)

        ts3lib.requestChannelDescription(schid, channelID)
        (error, description) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelProperties.CHANNEL_DESCRIPTION)
        if debug: print("err:", error, "CHANNEL_DESCRIPTION", description)
        if not error and description: ts3lib.setChannelVariableAsString(schid, 0,ts3defines.ChannelProperties.CHANNEL_DESCRIPTION,description.decode('utf-8'))
        """
        (error, neededtp) = ts3lib.getChannelVariable(
            schid, channelID,
            ts3defines.ChannelPropertiesRare.CHANNEL_NEEDED_TALK_POWER)
        if debug: print("err:", error, "CHANNEL_NEEDED_TALK_POWER", neededtp)
        if not error and neededtp:
            ts3lib.setChannelVariableAsInt(
                schid, 0,
                ts3defines.ChannelPropertiesRare.CHANNEL_NEEDED_TALK_POWER,
                neededtp)

        (error, codec) = ts3lib.getChannelVariable(
            schid, channelID, ts3defines.ChannelProperties.CHANNEL_CODEC)
        if debug: print("err:", error, "CHANNEL_CODEC", codec)
        if not error and codec:
            ts3lib.setChannelVariableAsInt(
                schid, 0, ts3defines.ChannelProperties.CHANNEL_CODEC, codec)

        (error, quality) = ts3lib.getChannelVariable(
            schid, channelID,
            ts3defines.ChannelProperties.CHANNEL_CODEC_QUALITY)
        if debug: print("err:", error, "CHANNEL_CODEC_QUALITY", quality)
        if not error and quality:
            ts3lib.setChannelVariableAsInt(
                schid, 0, ts3defines.ChannelProperties.CHANNEL_CODEC_QUALITY,
                quality)

        (error, latency) = ts3lib.getChannelVariable(
            schid, channelID,
            ts3defines.ChannelProperties.CHANNEL_CODEC_LATENCY_FACTOR)
        if debug: print("err:", error, "CHANNEL_CODEC_LATENCY_FACTOR", latency)
        if not error and latency:
            ts3lib.setChannelVariableAsInt(
                schid, 0,
                ts3defines.ChannelProperties.CHANNEL_CODEC_LATENCY_FACTOR,
                latency)

        (error, unencrypted) = ts3lib.getChannelVariable(
            schid, channelID,
            ts3defines.ChannelProperties.CHANNEL_CODEC_IS_UNENCRYPTED)
        if debug:
            print("err:", error, "CHANNEL_CODEC_IS_UNENCRYPTED", unencrypted)
        if not error and unencrypted:
            ts3lib.setChannelVariableAsInt(
                schid, 0,
                ts3defines.ChannelProperties.CHANNEL_CODEC_IS_UNENCRYPTED,
                unencrypted)

        (error, maxclients) = ts3lib.getChannelVariable(
            schid, channelID, ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS)
        if debug: print("err:", error, "CHANNEL_MAXCLIENTS", maxclients)
        if not error and maxclients:
            ts3lib.setChannelVariableAsInt(
                schid, 0, ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS,
                maxclients)

        (error, maxfamilyclients) = ts3lib.getChannelVariable(
            schid, channelID,
            ts3defines.ChannelProperties.CHANNEL_MAXFAMILYCLIENTS)
        if debug:
            print("err:", error, "CHANNEL_MAXFAMILYCLIENTS", maxfamilyclients)
        if not error and maxfamilyclients:
            ts3lib.setChannelVariableAsInt(
                schid, 0,
                ts3defines.ChannelProperties.CHANNEL_MAXFAMILYCLIENTS,
                maxfamilyclients)

        (error, iconid) = ts3lib.getChannelVariable(
            schid, channelID, ts3defines.ChannelPropertiesRare.CHANNEL_ICON_ID)
        if debug: print("err:", error, "CHANNEL_ICON_ID", iconid)
        if not error and iconid:
            ts3lib.setChannelVariableAsInt(
                schid, 0, ts3defines.ChannelPropertiesRare.CHANNEL_ICON_ID,
                iconid)

        ts3lib.flushChannelCreation(schid, 0)