コード例 #1
0
    def send_login_response(self, username, password, nonce):
        '''
        Called by protocol in response to a login_challenge event
        '''

        password = password.lower()[:self.PASSWORD_MAX_LENGTH]

        if not isinstance(password, bytes):
            password = password.encode('utf8')

        if not isinstance(username, bytes):
            username = username.encode('utf8')

        res = myspace_auth_challenge_response(username, password, nonce)
        STA = 100
        ID = 1

        res = base64.b64encode(res)

        msg = msmsg((
            ('login2', self.LOGINID),
            ('username', username),
            ('response', res),
            ('clientver', self.CLIENTVER),
            ('reconn', 0),
            ('status', STA),
            ('id', ID),
        ))

        self.send_msg(msg)
コード例 #2
0
ファイル: MSIMApi.py プロジェクト: AlexUlrich/digsby
    def send_login_response(self, username, password, nonce):
        '''
        Called by protocol in response to a login_challenge event
        '''

        password = password.lower()[:self.PASSWORD_MAX_LENGTH]

        if not isinstance(password, bytes):
            password = password.encode('utf8')

        if not isinstance(username, bytes):
            username = username.encode('utf8')

        res = myspace_auth_challenge_response(username, password, nonce)
        STA = 100
        ID = 1

        res = base64.b64encode(res)

        msg = msmsg((
            ('login2',    self.LOGINID),
            ('username',  username),
            ('response',  res),
            ('clientver', self.CLIENTVER),
            ('reconn',    0),
            ('status',    STA),
            ('id',        ID),
        ))

        self.send_msg(msg)
コード例 #3
0
    def deletebuddy(self, buddy_id):
        msg = msmsg((
            ('delbuddy', ''),
            ('sesskey', self.sesskey),
            ('delprofileid', buddy_id),
        ))

        self.send_msg(msg)
コード例 #4
0
ファイル: MSIMApi.py プロジェクト: AlexUlrich/digsby
    def request_webchlg(self):
        msg = msmsg((
            ('webchlg', ''),
            ('sesskey', self.sesskey),
            ('n', 0),
        ))

        self.send_msg(msg)
コード例 #5
0
ファイル: MSIMApi.py プロジェクト: AlexUlrich/digsby
    def deletebuddy(self, buddy_id):
        msg = msmsg((
            ('delbuddy', ''),
            ('sesskey', self.sesskey),
            ('delprofileid', buddy_id),
        ))

        self.send_msg(msg)
コード例 #6
0
    def request_webchlg(self):
        msg = msmsg((
            ('webchlg', ''),
            ('sesskey', self.sesskey),
            ('n', 0),
        ))

        self.send_msg(msg)
コード例 #7
0
    def addbuddy(self, buddy_id, reason):
        msg = msmsg((
            ('addbuddy', ''),
            ('sesskey', self.sesskey),
            ('newprofileid', buddy_id),
            ('reason', reason),
        ))

        self.send_msg(msg)
コード例 #8
0
ファイル: MSIMApi.py プロジェクト: AlexUlrich/digsby
    def set_status(self, status_int, status_string, locstring):
        msg = msmsg((
            ('status',     status_int),
            ('sesskey',    self.sesskey),
            ('statstring', status_string),
            ('locstring',  locstring),
        ))

        self.send_msg(msg)
コード例 #9
0
 def send_typing(self, who, typing):
     msg = msmsg((
         ('bm', BmMessage.Type.ActionMessage),
         ('sesskey', self.sesskey),
         ('t', who),
         ('cv', self.CLIENTVER),
         ('msg', '%typing%' if typing else '%stoptyping%'),
     ))
     self.send_msg(msg)
コード例 #10
0
ファイル: MSIMApi.py プロジェクト: AlexUlrich/digsby
 def send_typing(self, who, typing):
     msg = msmsg((
         ('bm',        BmMessage.Type.ActionMessage),
         ('sesskey',   self.sesskey),
         ('t',         who),
         ('cv',        self.CLIENTVER),
         ('msg',       '%typing%' if typing else '%stoptyping%'),
     ))
     self.send_msg(msg)
コード例 #11
0
ファイル: MSIMApi.py プロジェクト: AlexUlrich/digsby
    def addbuddy(self, buddy_id, reason):
        msg = msmsg((
            ('addbuddy', ''),
            ('sesskey', self.sesskey),
            ('newprofileid', buddy_id),
            ('reason', reason),
        ))

        self.send_msg(msg)
コード例 #12
0
    def set_status(self, status_int, status_string, locstring):
        msg = msmsg((
            ('status', status_int),
            ('sesskey', self.sesskey),
            ('statstring', status_string),
            ('locstring', locstring),
        ))

        self.send_msg(msg)
コード例 #13
0
    def logout(self):
        if self.sesskey is None:
            return

        msg = msmsg((
            ('logout', ''),
            ('sesskey', self.sesskey),
        ))

        self.send_msg(msg)
コード例 #14
0
 def send_exitchat(self, who, gid):
     msg = msmsg((
         ('bm', BmMessage.Type.ActionMessage),
         ('sesskey', self.sesskey),
         ('t', who),
         ('cv', self.CLIENTVER),
         ('gid', gid),
         ('msg', '!!!ExitChat'),
     ))
     self.send_msg(msg)
コード例 #15
0
ファイル: MSIMApi.py プロジェクト: AlexUlrich/digsby
    def logout(self):
        if self.sesskey is None:
            return

        msg = msmsg((
                     ('logout', ''),
                     ('sesskey', self.sesskey),
                     ))

        self.send_msg(msg)
コード例 #16
0
ファイル: MSIMApi.py プロジェクト: AlexUlrich/digsby
 def send_exitchat(self, who, gid):
     msg = msmsg((
         ('bm',        BmMessage.Type.ActionMessage),
         ('sesskey',   self.sesskey),
         ('t',         who),
         ('cv',        self.CLIENTVER),
         ('gid',       gid),
         ('msg',       '!!!ExitChat'),
     ))
     self.send_msg(msg)
コード例 #17
0
    def send_im(self, who, message, callback=None):
        _message, message = message, msim_util.escape(message)

        msg = msmsg((
            ('bm', BmMessage.Type.InstantMessage),
            ('sesskey', self.sesskey),
            ('t', who),
            ('cv', self.CLIENTVER),
            ('msg', message),
        ))
        try:
            self.send_msg(msg)
        except Exception, e:
            callback.error(e)
            raise
コード例 #18
0
ファイル: MSIMApi.py プロジェクト: AlexUlrich/digsby
    def send_im(self, who, message, callback=None):
        _message, message = message, msim_util.escape(message)

        msg = msmsg((
            ('bm',        BmMessage.Type.InstantMessage),
            ('sesskey',   self.sesskey),
            ('t',         who),
            ('cv',        self.CLIENTVER),
            ('msg',       message),
        ))
        try:
            self.send_msg(msg)
        except Exception, e:
            callback.error(e)
            raise
コード例 #19
0
ファイル: MSIMApi.py プロジェクト: AlexUlrich/digsby
    def _do_command(self, cmd, body):
        parts = [('persist', '1')]

        if self.use_sesskey:
            parts.append(('sesskey', self.proto.sesskey))

        parts.append(('cmd', cmd))
        parts.append(('dsn', self.dsn))

        if self.use_uid:
            parts.append(('uid', self.proto.userid))

        parts.append(('lid', self.lid))
        parts.append(('body', body))

        msg = msmsg(parts)

        return msg
コード例 #20
0
    def _do_command(self, cmd, body):
        parts = [('persist', '1')]

        if self.use_sesskey:
            parts.append(('sesskey', self.proto.sesskey))

        parts.append(('cmd', cmd))
        parts.append(('dsn', self.dsn))

        if self.use_uid:
            parts.append(('uid', self.proto.userid))

        parts.append(('lid', self.lid))
        parts.append(('body', body))

        msg = msmsg(parts)

        return msg
コード例 #21
0
 def found_terminator(self):
     log.debug_s('in : %r %r', self.buffer, self.terminator)
     self.event('on_message', self, msmsg(self.buffer + self.terminator))
     self.buffer = ''
     self.set_terminator(self.terminator)