from twisted.internet.protocol import ClientFactory
from twisted.internet.ssl import ClientContextFactory
from twisted.python import failure, log
-from twisted.xish.domish import unescapeFromXml, SuxElementStream
+from twisted.xish.domish import unescapeFromXml
+
+# Compat stuff
+from tlib import xmlw
# System imports
import types, operator, os, sys, base64, random
self.groups = {}
self.autoAdd = 0
self.privacy = 0
+ self.version = 0
def _getContactsFromList(self, listType):
"""
self.gotRealtimeEmailNotification(mailfrom, fromaddr, subject)
def _gotMSNAlert(self, message):
- notification = utils.parseText(message.message, beExtremelyLenient=True)
+ notification = xmlw.parseText(message.message, beExtremelyLenient=True)
siteurl = notification.getAttribute("siteurl")
notid = notification.getAttribute("id")
def handle_CHG(self, params):
id = int(params[0])
if not self._fireCallback(id, params[1]):
- self.factory.status = statusCode
+ self.factory.status = params[1]
self.statusChanged(params[1])
def handle_ILN(self, params):
msnContact.screenName = unquote(params[3])
if len(params) > 4: msnContact.caps = int(params[4])
if len(params) > 5: self.handleAvatarHelper(msnContact, params[5])
- self.contactStatusChanged(params[1], params[2], unquote(params[3]))
+ self.gotContactStatus(params[1], params[2], unquote(params[3]))
def handleAvatarHelper(self, msnContact, msnobjStr):
s = unquote(msnobjStr)
def handle_FLN(self, params):
checkParamLen(len(params), 1, 'FLN')
- msnContact = self.factory.contacts.getContact(userHandle)
+ msnContact = self.factory.contacts.getContact(params[0])
if msnContact:
msnContact.status = STATUS_OFFLINE
self.contactOffline(params[0])
if p[0] == 'N':
userHandle = getVal(p)
elif p[0] == 'F':
- screenName = getVal(p)
+ screenName = unquote(getVal(p))
elif p[0] == 'C':
userGuid = getVal(p)
elif p.isdigit():
if numParams == 2: # part of a syn
self._getStateData('last_contact').setPhone(params[0], unquote(params[1]))
elif numParams == 4:
+ self.factory.contacts.version = int(params[0])
+ userHandle, phoneType, number = params[1], params[2], unquote(params[3])
self.factory.contacts.getContact(userHandle).setPhone(phoneType, number)
- self.gotPhoneNumber(params[1], params[2], unquote(params[3]))
+ self.gotPhoneNumber(userHandle, phoneType, number)
def handle_ADG(self, params):
"""
pass
+ def gotContactStatus(self, statusCode, userHandle, screenName):
+ """
+ Called when we receive a list of statuses upon login.
+
+ @param statusCode: 3-letter status code
+ @param userHandle: the contact's user handle (passport)
+ @param screenName: the contact's screen name
+ """
+ pass
+
def contactStatusChanged(self, statusCode, userHandle, screenName):
"""
Called when we're notified that a contact's status has changed.
- By default we will update the status attribute and screenName
- of the contact stored on the factory.
@param statusCode: 3-letter status code
@param userHandle: the contact's user handle (passport)