Exemplo n.º 1
0
 def connectionInitialized(self):
     MessageProtocol.connectionInitialized(self)
     RosterClientProtocol.connectionInitialized(self)
     PresenceClientProtocol.connectionInitialized(self)
     
     #Call to handler
     self._xmpphandler.onAuthenticated()
Exemplo n.º 2
0
def createClient(bosh, domain, debug):
    if bosh:
        factory = BOSHClientFactory(jid.internJID(domain), None)
    else:
        factory = ClientFactory(jid.internJID(domain), None)
    factory.streamManager.logTraffic = debug

    protocol = MessageProtocol()
    protocol.setHandlerParent(factory.streamManager)

    if bosh:
        yield boshClientCreator(bosh, factory)
    else:
        yield client.clientCreator(factory)
Exemplo n.º 3
0
    def connectionInitialized(self):
        MessageProtocol.connectionInitialized(self)

        if self.presenceHandler is None:
            # Look for a presence handler
            for handler in self.parent:
                if isinstance(handler, PresenceProtocol):
                    self.presenceHandler = handler
                    break

        # Send presence to the room to join
        if self.presenceHandler is not None:
            self.presenceHandler.available(recipient=self.occupantJID)
        else:
            log.msg("No presence handler available for this connection!")
Exemplo n.º 4
0
    def __init__(self, jid):
        MessageProtocol.__init__(self)
        self.jid = jid
        self.help = []

        self.commands = {}
        for (name, klass) in inspect.getmembers(commands, inspect.isclass):
            if not name in ('Command', 'User'):
                self.commands[name] = klass
                if hasattr(klass, 'aliases'):
                    for alias in klass.aliases:
                        self.commands[alias] = klass
                if name in HELP_COMMANDS:
                    if hasattr(klass, 'usage'):
                        self.help.append("%s %s" % (name, klass.usage))
        self.help = "\n".join(self.help)
        self.session = accounts.Datastore().get_session()
Exemplo n.º 5
0
    def __init__(self, jid):
        MessageProtocol.__init__(self)
        self.jid = jid
        self.help = []

        self.commands = {}
        for (name, klass) in inspect.getmembers(commands, inspect.isclass):
            if not name in ("Command", "User"):
                self.commands[name] = klass
                if hasattr(klass, "aliases"):
                    for alias in klass.aliases:
                        self.commands[alias] = klass
                if name in HELP_COMMANDS:
                    if hasattr(klass, "usage"):
                        self.help.append("%s %s" % (name, klass.usage))
        self.help = "\n".join(self.help)
        self.session = accounts.Datastore().get_session()
 def __init__(self, backend_interaction, component=False):
     '''
     @param backend_interaction: The handler for cumminicating with the logic of the backend.
     @type backend_interaction: ServerInteraction 
     '''
     #init XEPs
     MessageProtocol.__init__(self)
     LocationQuery.__init__(self)
     JabberRPC.__init__(self)
     IQBasedAvatar.__init__(self)
     PresenceClientProtocol.__init__(self)
     self.component = component
     
     #register rpc functions
     self.registerMethodCall('getSettings', self.onGetSettings)
     self.registerMethodCall('setSettings', self.onSetSettings)
     self.registerMethodCall('getUserInfo', self.onGetUserInfo)
     self.registerMethodCall('createFriendship', self.onCreateFriendship)
     self.registerMethodCall('destroyFriendship', self.onDestroyFriendship)
     
     #give the backend (ServerInteraction) a reference to this protocol handler
     self.backend = backend_interaction
     self.backend.set_server_component(self)
 def connectionInitialized(self):
     LocationQuery.connectionInitialized(self)
     JabberRPC.connectionInitialized(self)
     MessageProtocol.connectionInitialized(self)
     IQBasedAvatar.connectionInitialized(self)
     PresenceClientProtocol.connectionInitialized(self)
Exemplo n.º 8
0
 def __init__(self, component=False, socket=None):
     MessageProtocol.__init__(self)
     self.component = component
     self._socket = socket
     self._message_count = 0
     self._begin_time = None
Exemplo n.º 9
0
 def connectionInitialized(self):
     MessageProtocol.connectionInitialized(self)
     PresenceClientProtocol.connectionInitialized(self)
     self.statii = {}
     self.ignoring = DefaultDict()
     self.ignoring.f = lambda x: sets.Set()
Exemplo n.º 10
0
 def __init__(self, output, hostname, targetjid, *args, **kwargs):
     self.output = output
     self.hostname = hostname
     self.targetjid = targetjid
     MessageProtocol.__init__(self, *args, **kwargs)
Exemplo n.º 11
0
 def __init__(self):
     MessageProtocol.__init__(self)
Exemplo n.º 12
0
 def connectionInitialized(self):
     MessageProtocol.connectionInitialized(self)
     PresenceClientProtocol.connectionInitialized(self)
     self.statii = {}
     self.ignoring = defaultdict(set)
Exemplo n.º 13
0
 def __init__(self, bot):
     self.bot=bot
     MessageProtocol.__init__(self)
Exemplo n.º 14
0
 def connectionInitialized(self):
     MessageProtocol.connectionInitialized(self)
     PresenceClientProtocol.connectionInitialized(self)
Exemplo n.º 15
0
 def __init__(self):
     MessageProtocol.__init__(self)
Exemplo n.º 16
0
 def connectionInitialized(self):
     print 'Initializing connection'
     MessageProtocol.connectionInitialized(self)
     PresenceClientProtocol.connectionInitialized(self)
     RosterClientProtocol.connectionInitialized(self)
     self.getRoster().addCallback(self.processRoster)
Exemplo n.º 17
0
 def __init__(self):
     MessageProtocol.__init__(self)
     self.mpdclient = mpdclient.MpdClient()
     self.mpdclient.connect()
Exemplo n.º 18
0
 def __init__(self, xmpphandler):
     MessageProtocol.__init__(self)
     self._xmpphandler = xmpphandler
     self._xmpphandler.setProtocol(self)
Exemplo n.º 19
0
 def __init__(self, bot):
     self.bot = bot
     MessageProtocol.__init__(self)
Exemplo n.º 20
0
 def __init__(self, *args, **kwargs):
     MessageProtocol.__init__(self, *args, **kwargs)
     self.running = True
     self.emails = []
Exemplo n.º 21
0
Arquivo: echobot.py Projeto: zh/wip
 def __init__(self, component=False):
     MessageProtocol.__init__(self)
     self.component = component
Exemplo n.º 22
0
 def __init__(self, component=False):
     MessageProtocol.__init__(self)
     self.component = component
Exemplo n.º 23
0
 def __init__(self, component, jid_act_as, jid_proxy_to):
     MessageProtocol.__init__(self)
     XmppProxyHandler.__init__(self, component, jid_act_as, jid_proxy_to)
Exemplo n.º 24
0
 def connectionInitialized(self):
     MessageProtocol.connectionInitialized(self)
     PresenceClientProtocol.connectionInitialized(self)
 def __init__(self, endpoint):
     MessageProtocol.__init__(self)
     self.endpoint = endpoint