def parseCustomEmoticon(self, message): body = message.split('\r\n\r\n')[1] l = body.split('\t') d = {} while len(l) > 0: if len(l) < 2: break shortcut = l.pop(0) msnobjString = l.pop(0) msnobj = Msnobj.createFromString(msnobjString, False) if msnobj != None: self.emit('custom-emoticon-received', shortcut, msnobj) filename = shortcut + '_' + msnobj.sha1d + '.tmp' filename = urllib.quote(filename).replace('/', '_') completeFileName = self.msn.cacheDir + os.sep + filename if not os.path.isfile(completeFileName): # WLM doesn't reply invites before the actual MSG mail = msnobj.getCreator() if mail not in self.pendingCEs: self.pendingCEs[mail] = [] self.pendingCEs[mail].append((mail, msnobj, \ completeFileName)) else: self.msn.emit('custom-emoticon-transfered', None, \ msnobj, completeFileName)
def statusChange( self, msnp, command, tid, params ): '''handle a status change''' global flag #ILN 9 IDL [email protected] .%20J%20i%20N%20G%20. 1342554148 %3Cmsnobj%20Creator%3D%22xxxxxxxxxxxxx%40yahoo.it%22%20Size%3D%225637%22%20Type%3D%223%22%20Location%3D%22TFR10B.dat%22%20Friendly%3D%22AAA%3D%22%20SHA1D%3D%22X0qXqwshIMyNnCGFYDEmOrLfFrE%3D%22%20SHA1C%3D%22CTsCEDGiY82DrNMYGVJAj01x%2F%2BA%3D%22%2F%3E t = params.split( " " ) status = t[ 0 ] email = t[ 1 ].lower() nick = urllib.unquote(t[2]) nick = nick.decode('utf-8', 'replace').encode('utf-8') oldStatus = self.msn.contactManager.getContactStatus( email ) self.msn.contactManager.setContactStatus( email, status ) self.msn.contactManager.setContactNick( email, nick ) if len( t ) == 5: msnobj = t[ 4 ] contact = self.msn.contactManager.getContact( email ) if contact != None: msnObject = Msnobj.createFromString( msnobj ) if contact.msnobj == None or \ (msnObject != None and msnObject != contact.msnobj): contact.msnobj = msnObject self.msn.emit( 'msnobj-changed', msnObject, (oldStatus=='FLN') ) if self.msn.contactManager.getContactNick( email ) != nick: self.msn.emit( 'nick-changed', email, nick ) if self.msn.contactManager.getContactStatus(email) != status: self.msn.emit('contact-status-change', email, status) contact = self.msn.contactManager.getContact(email) self.msn.emit('user-attr-changed', contact)
def statusOnline( self, msnp, command, tid, params ): '''handle a friend going online''' status = tid t = params.split(' ') email = t[ 0 ].lower() nick = urllib.unquote(t[1]) nick = nick.decode('utf-8', 'replace').encode('utf-8') oldStatus = self.msn.contactManager.getContactStatus( email ) self.msn.contactManager.setContactStatus( email, status ) if len( t ) == 4: msnobj = t[ 3 ] contact = self.msn.contactManager.getContact( email ) if contact != None: msnObject = Msnobj.createFromString( msnobj ) if contact.msnobj == None or \ (msnObject != None and \ msnObject != contact.msnobj): contact.msnobj = msnObject self.msn.emit( 'msnobj-changed', msnObject, (oldStatus=='FLN') ) if self.msn.contactManager.getContactNick( email ) != nick: self.msn.emit( 'nick-changed', email, nick ) self.msn.contactManager.setContactNick( email, nick ) if oldStatus != status: common.debug('%s (%s) changed status from %s to %s' % \ (nick, email, oldStatus, status), 'signal handler') self.msn.emit( 'user-online', email, oldStatus ) self.msn.emit( 'contact-status-change', email, status ) contact = self.msn.contactManager.getContact( email ) self.msn.emit( 'user-attr-changed', contact )
def statusChange( self, msnp, command, tid, params ): '''handle a status change''' global flag t = params.split( " " ) status = t[ 0 ] email = t[ 1 ].lower() nick = urllib.unquote(t[2]) nick = nick.decode('utf-8', 'replace').encode('utf-8') oldStatus = self.msn.contactManager.getContactStatus( email ) self.msn.contactManager.setContactStatus( email, status ) self.msn.contactManager.setContactNick( email, nick ) if len( t ) == 5: msnobj = t[ 4 ] contact = self.msn.contactManager.getContact( email ) if contact != None: msnObject = Msnobj.createFromString( msnobj ) if contact.msnobj == None or \ (msnObject != None and msnObject != contact.msnobj): contact.msnobj = msnObject self.msn.emit( 'msnobj-changed', msnObject, (oldStatus=='FLN') ) if self.msn.contactManager.getContactNick( email ) != nick: self.msn.emit( 'nick-changed', email, nick ) if self.msn.contactManager.getContactStatus(email) != status: self.msn.emit('contact-status-change', email, status) contact = self.msn.contactManager.getContact(email) self.msn.emit('user-attr-changed', contact)
def statusOnline( self, msnp, command, tid, params ): '''handles NLN messages which notify when a contact logs in or changes status, nick, capabilities, msnobj, etc''' status = tid t = params.split(' ') email = t[0].lower() nick = urllib.unquote(t[2]).decode('utf-8', 'replace').encode('utf-8') oldStatus = self.msn.contactManager.getContactStatus( email ) self.msn.contactManager.setContactStatus( email, status ) if len( t ) == 5: msnobj = t[4] contact = self.msn.contactManager.getContact( email ) contact.clientid = int(t[3]) if contact != None: msnObject = Msnobj.createFromString( msnobj ) if contact.msnobj == None or \ (msnObject != None and \ msnObject != contact.msnobj): contact.msnobj = msnObject self.msn.emit( 'msnobj-changed', msnObject, (oldStatus=='FLN') ) if self.msn.contactManager.getContactNick( email ) != nick: self.msn.emit( 'nick-changed', email, nick ) self.msn.contactManager.setContactNick( email, nick ) if oldStatus != status: common.debug('%s (%s) changed status from %s to %s' % \ (nick, email, oldStatus, status), 'signal handler') self.msn.emit( 'user-online', email, oldStatus ) self.msn.emit( 'contact-status-change', email, status ) contact = self.msn.contactManager.getContact( email ) self.msn.emit( 'user-attr-changed', contact )
def statusChange( self, msnp, command, tid, params ): '''handles ILN messages and status-change signals, which are never emitted. So only ILN''' t = params.split( " " ) status = t[ 0 ] email = t[ 1 ].lower() nick = urllib.unquote(t[3]) nick = nick.decode('utf-8', 'replace').encode('utf-8') oldStatus = self.msn.contactManager.getContactStatus( email ) self.msn.contactManager.setContactStatus( email, status ) self.msn.contactManager.setContactNick( email, nick ) if len(t) == 6: msnobj = t[5] contact = self.msn.contactManager.getContact(email) if contact != None: contact.clientid = int(t[4]) msnObject = Msnobj.createFromString(msnobj) if contact.msnobj == None or \ (msnObject != None and msnObject != contact.msnobj): contact.msnobj = msnObject self.msn.emit( 'msnobj-changed', msnObject, (oldStatus=='FLN') ) if self.msn.contactManager.getContactNick( email ) != nick: self.msn.emit( 'nick-changed', email, nick ) if self.msn.contactManager.getContactStatus(email) != status: self.msn.emit('contact-status-change', email, status) contact = self.msn.contactManager.getContact(email) self.msn.emit('user-attr-changed', contact)
def statusOnline( self, msnp, command, tid, params ): '''handles NLN messages which notify when a contact logs in or changes status, nick, capabilities, msnobj, etc''' status = tid t = params.split(' ') email = t[0].lower() nick = urllib.unquote(t[2]).decode('utf-8', 'replace').encode('utf-8') oldStatus = self.msn.contactManager.getContactStatus( email ) self.msn.contactManager.setContactStatus( email, status ) if len( t ) == 5: msnobj = t[4] contact = self.msn.contactManager.getContact( email ) contact.clientid = int(t[3]) if contact != None: msnObject = Msnobj.createFromString( msnobj ) if contact.msnobj == None or \ (msnObject != None and \ msnObject != contact.msnobj): contact.msnobj = msnObject self.msn.emit( 'msnobj-changed', msnObject, (oldStatus=='FLN') ) if self.msn.contactManager.getContactNick( email ) != nick: self.msn.emit( 'nick-changed', email, nick ) self.msn.contactManager.setContactNick( email, nick ) if oldStatus != status: common.debug('%s (%s) changed status from %s to %s' % \ (nick, email, oldStatus, status), 'signal handler') self.msn.emit('user-online', email, oldStatus) self.msn.emit('contact-status-change', email, status) contact = self.msn.contactManager.getContact( email ) self.msn.emit( 'user-attr-changed', contact )
def statusChange( self, msnp, command, tid, params ): '''handles ILN messages and status-change signals, which are never emitted. So only ILN''' #ILN 9 IDL [email protected] .%20J%20i%20N%20G%20. 1342554148 %3Cmsnobj%20Creator%3D%22xxxxxxxxxxxxx%40yahoo.it%22%20Size%3D%225637%22%20Type%3D%223%22%20Location%3D%22TFR10B.dat%22%20Friendly%3D%22AAA%3D%22%20SHA1D%3D%22X0qXqwshIMyNnCGFYDEmOrLfFrE%3D%22%20SHA1C%3D%22CTsCEDGiY82DrNMYGVJAj01x%2F%2BA%3D%22%2F%3E t = params.split( " " ) status = t[ 0 ] email = t[ 1 ].lower() nick = urllib.unquote(t[3]) nick = nick.decode('utf-8', 'replace').encode('utf-8') if status == 'HDN': # this was getting pretty annoying to me. --dxdx status = 'FLN' oldStatus = self.msn.contactManager.getContactStatus( email ) self.msn.contactManager.setContactStatus( email, status ) self.msn.contactManager.setContactNick( email, nick ) if len(t) == 6: msnobj = t[5] contact = self.msn.contactManager.getContact(email) if contact != None: contact.clientid = int(t[4]) msnObject = Msnobj.createFromString(msnobj) if contact.msnobj == None or \ (msnObject != None and msnObject != contact.msnobj): contact.msnobj = msnObject self.msn.emit( 'msnobj-changed', msnObject, (oldStatus=='FLN') ) if self.msn.contactManager.getContactNick( email ) != nick: self.msn.emit( 'nick-changed', email, nick ) if self.msn.contactManager.getContactStatus(email) != status: self.msn.emit('contact-status-change', email, status) contact = self.msn.contactManager.getContact(email) self.msn.emit('user-attr-changed', contact)