rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
if len(params) != 4 and len(params) != 5:
if len(params) != 4 and len(params) != 6:
def handle_USR(self, params): if len(params) != 4 and len(params) != 5: raise MSNProtocolError, "Invalid Number of Parameters for USR"
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
self.sendLine("USR %s MD5 S %s" % (self._nextTransactionID(), md5.md5(params[3]+self.password).hexdigest().lower()))
f = self.factory d = _login(f.userHandle, f.password, f.passportServer, authData=params[3]) d.addCallback(self._passportLogin) d.addErrback(self._passportError) def _passportLogin(self, result): if result[0] == LOGIN_REDIRECT: d = _login(self.factory.userHandle, self.factory.password, result[1], cached=1, authData=re...
def handle_USR(self, params): if len(params) != 4 and len(params) != 5: raise MSNProtocolError, "Invalid Number of Parameters for USR"
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
checkParamLen(len(params), 2, 'CHG')
checkParamLen(len(params), 3, 'CHG')
def handle_CHG(self, params): checkParamLen(len(params), 2, 'CHG') id = int(params[0]) if not self._fireCallback(id, params[1]): self.statusChanged(params[1])
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
checkParamLen(len(params), 4, 'ILN')
checkParamLen(len(params), 5, 'ILN')
def handle_ILN(self, params): checkParamLen(len(params), 4, 'ILN') self.gotContactStatus(params[1], params[2], unquote(params[3]))
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
checkParamLen(len(params), 3, 'NLN')
checkParamLen(len(params), 4, 'NLN')
def handle_NLN(self, params): checkParamLen(len(params), 3, 'NLN') self.contactStatusChanged(params[0], params[1], unquote(params[2]))
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
if not self.ids.has_key(id): return if self.ids[id][1]: syn = 1 else: syn = 0 user = self._createUserFromListReply(params[1:]) if user: if self._pendingLists.has_key(id): self._pendingLists[id].append(user) else: self._pendingLists[id] = [user] self.listState = (None, id) if not syn and (params[3] == params[4]): if p...
if len(params) == 2: self._setState('SESSION') self._fireCallback(id, None, None) else: contacts = MSNContactList() contacts.version = int(params[1]) self._setStateData('list', contacts) self._setStateData('lst_reply', int(params[2])) self._setStateData('lsg_reply', int(params[3])) self._setStateData('lst_sofar', 0) se...
def handle_LST(self, params): id = int(params[0]) if not self.ids.has_key(id): return # XXX: should we raise an exception? if self.ids[id][1]: syn = 1 # part of a syn response else: syn = 0 # part of a lst response
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
if numParams < 2: raise MSNProtocolError, "Invalid Number of Paramaters for GTC" id = int(params[0]) if self.ids.has_key(id): if self.ids[id][1]: checkParamLen(numParams, 3, 'GTC') if params[2].lower() == "a": self._pendingState['autoAdd'] = 0 elif params[2].lower() == "n": self._pendingState['autoAdd'] = 1 else: rais...
if numParams == 2: self._getStateData('last_contact').setPhone(params[0], unquote(params[1])) elif numParams == 4: self.gotPhoneNumber(int(params[0]), params[1], params[2], unquote(params[3]))
def handle_GTC(self, params): numParams = len(params) if numParams < 2: raise MSNProtocolError, "Invalid Number of Paramaters for GTC" # debug id = int(params[0]) if self.ids.has_key(id): # check to see if this is in response to a SYN if self.ids[id][1]: checkParamLen(numParams, 3, 'GTC') # debug if params[2].lower() =...
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
listType = params[1]
listType = params[1].lower()
def handle_ADD(self, params): numParams = len(params) if numParams < 5 or params[1].upper() not in ('AL','BL','RL','FL'): raise MSNProtocolError, "Invalid Paramaters for ADD" # debug id = int(params[0]) listType = params[1] listVer = int(params[2]) userHandle = params[3] groupID = None if numParams == 6: # they sent a ...
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
if not self._fireCallback(id, listType, userHandle, listVer, groupID):
if not self._fireCallback(id, listCodeToID[listType], userHandle, listVer, groupID):
def handle_ADD(self, params): numParams = len(params) if numParams < 5 or params[1].upper() not in ('AL','BL','RL','FL'): raise MSNProtocolError, "Invalid Paramaters for ADD" # debug id = int(params[0]) listType = params[1] listVer = int(params[2]) userHandle = params[3] groupID = None if numParams == 6: # they sent a ...
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
listType = params[1]
listType = params[1].lower()
def handle_REM(self, params): numParams = len(params) if numParams < 4 or params[1].upper() not in ('AL','BL','FL','RL'): raise MSNProtocolError, "Invalid Paramaters for REM" # debug id = int(params[0]) listType = params[1] listVer = int(params[2]) userHandle = params[3] groupID = None if numParams == 5: if params[1] !...
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
if not self._fireCallback(id, listType, userHandle, listVer, groupID):
if not self._fireCallback(id, listCodeToID[listType], userHandle, listVer, groupID):
def handle_REM(self, params): numParams = len(params) if numParams < 4 or params[1].upper() not in ('AL','BL','FL','RL'): raise MSNProtocolError, "Invalid Paramaters for REM" # debug id = int(params[0]) listType = params[1] listVer = int(params[2]) userHandle = params[3] groupID = None if numParams == 5: if params[1] !...
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" called when the client has logged in @param userHandle: our userHandle @param screenName: our screenName @param verified: 1 if our passport has been (verified), 0 if not. (i'm not sure of the significace of this) @type verified: int
""" Called when the client has logged in. The default behaviour of this method is to update the factory with our screenName and to sync the contact list (factory.contacts). When this is complete self.listSynchronized will be called. @param userHandle: our userHandle @param screenName: our screenName @param verified: 1...
def loggedIn(self, userHandle, screenName, verified): """ called when the client has logged in
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" called after logging in when the server sends an initial message with MSN/passport specific profile information such as country, number of kids, etc... Check the message headers for the specific values. @param message: The profile message
""" Called after logging in when the server sends an initial message with MSN/passport specific profile information such as country, number of kids, etc. Check the message headers for the specific values. @param message: The profile message
def gotProfile(self, message): """ called after logging in when the server sends an initial message with MSN/passport specific profile information such as country, number of kids, etc... Check the message headers for the specific values.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" called when our status changes and it isn't in response to a client command. @param statusCode: 3-letter status code """ pass
""" Called when our status changes and it isn't in response to a client command. By default we will update the status attribute of the factory. @param statusCode: 3-letter status code """ self.factory.status = statusCode
def statusChanged(self, statusCode): """ called when our status changes and it isn't in response to a client command.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" called after loggin in when the server sends status of online contacts. @param statusCode: 3-letter status code @param userHandle: the contact's user handle (passport) @param screenName: the contact's screen name """ pass
""" Called after loggin in when the server sends status of online contacts. By default we will update the status attribute of the contact stored on the factory. @param statusCode: 3-letter status code @param userHandle: the contact's user handle (passport) @param screenName: the contact's screen name """ self.factory....
def gotContactStatus(self, statusCode, userHandle, screenName): """ called after loggin in when the server sends status of online contacts.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" called when we're notified that a contact's status has changed. @param statusCode: 3-letter status code @param userHandle: the contact's user handle (passport) @param screenName: the contact's screen name """ pass
""" Called when we're notified that a contact's status has changed. By default we will update the status attribute of the contact stored on the factory. @param statusCode: 3-letter status code @param userHandle: the contact's user handle (passport) @param screenName: the contact's screen name """ self.factory.contacts...
def contactStatusChanged(self, statusCode, userHandle, screenName): """ called when we're notified that a contact's status has changed.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" called when a contact goes offline. @param userHandle: the contact's user handle """ pass
""" Called when a contact goes offline. By default this method will update the status attribute of the contact stored on the factory. @param userHandle: the contact's user handle """ self.factory.contacts.getContact(userHandle).status = STATUS_OFFLINE
def contactOffline(self, userHandle): """ called when a contact goes offline.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" called when the server sends us phone details about a specific user (for example after a user is added the server will send their status, phone details etc ... @param listVersion: the new list version @param userHandle: the contact's user handle (passport) @param phoneType: the specific phoneType (*_PHONE constant...
""" Called when the server sends us phone details about a specific user (for example after a user is added the server will send their status, phone details etc. By default we will update the list version for the factory's contact list and update the phone details for the specific user. @param listVersion: the new list...
def gotPhoneNumber(self, listVersion, userHandle, phoneType, number): """ called when the server sends us phone details about a specific user (for example after a user is added the server will send their status, phone details etc ...
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" called when a user adds me to their list. (ie. they have been added to the reverse list. @param userHandle: the userHandle of the user @param screenName: the screen name of the user @param listVersion: the new list version @type listVersion: int """ pass
""" Called when a user adds me to their list. (ie. they have been added to the reverse list. By default this method will update the version of the factory's contact list -- that is, if the contact already exists it will update the associated lists attribute, otherwise it will create a new MSNContact object and store it...
def userAddedMe(self, userHandle, screenName, listVersion): """ called when a user adds me to their list. (ie. they have been added to the reverse list.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" called when a user removes us from their contact list (they are no longer on our reverseContacts list and changes to the underlying list should be made to reflect this). @param userHandle: the contact's user handle (passport) @param listVersion: the new list version """ pass
""" Called when a user removes us from their contact list (they are no longer on our reverseContacts list. By default this method will update the version of the factory's contact list -- that is, the user will be removed from the reverse list and if they are no longer part of any lists they will be removed from the con...
def userRemovedMe(self, userHandle, listVersion): """ called when a user removes us from their contact list (they are no longer on our reverseContacts list and changes to the underlying list should be made to reflect this).
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" called when we get an invitation to a switchboard server. This happens when a user requests a chat session with us. @param sessionID: session ID number, must be remembered for logging in @param host: the hostname of the switchboard server @param port: the port to connect to @param key: used for authorization when ...
""" Called when we get an invitation to a switchboard server. This happens when a user requests a chat session with us. @param sessionID: session ID number, must be remembered for logging in @param host: the hostname of the switchboard server @param port: the port to connect to @param key: used for authorization when ...
def gotSwitchboardInvitation(self, sessionID, host, port, key, userHandle, screenName): """ called when we get an invitation to a switchboard server. This happens when a user requests a chat session with us.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" called when the server says there has been another login under our account, the server should disconnect us right away.
""" Called when the server says there has been another login under our account, the server should disconnect us right away.
def multipleLogin(self): """ called when the server says there has been another login under our account, the server should disconnect us right away. """ pass
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" called when the server has notified us that it is going down for maintenance.
""" Called when the server has notified us that it is going down for maintenance.
def serverGoingDown(self): """ called when the server has notified us that it is going down for maintenance. """ pass
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" change my current status. @param status: 3-letter status code (as defined by the STATUS_* constants) @return: A Deferred, the callback of which will be fired when the server confirms the change of status. The callback argument will be a tuple with the new status code as the only element.
""" Change my current status. This method will add a default callback to the returned Deferred which will update the status attribute of the factory. @param status: 3-letter status code (as defined by the STATUS_* constants) @return: A Deferred, the callback of which will be fired when the server confirms the change o...
def changeStatus(self, status): """ change my current status.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
return d def requestList(self, listType): """ request the desired list type @param listType: 2-letter list type (as defined by the *_LIST constants) @return: A Deferred, the callback of which will be fired when the list has been retrieved. The callback argument will be a tuple with the only element being a list of M...
def _cb(r): self.factory.status = r[0] return r return d.addCallback(_cb)
def changeStatus(self, status): """ change my current status.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" set my privacy mode on the server. B{Note}: This only keeps the current privacy setting on the server for later retrieval, it does not effect the way the server works at all. @param privLevel: This parameter can be true, in which case the server will keep the state as 'al' which the official client interprets as ...
""" Set my privacy mode on the server. B{Note}: This only keeps the current privacy setting on the server for later retrieval, it does not effect the way the server works at all. @param privLevel: This parameter can be true, in which case the server will keep the state as 'al' which the official client interprets as ...
def setPrivacyMode(self, privLevel): """ set my privacy mode on the server.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" used for keeping an up-to-date contact list. @param version: The current known list version @return: A Deferred, the callback of which will be fired when the server sends an adequate reply. The callback argument will be a tuple with two elements, the new list (MSNContactList) and your current state (a dictionary)...
""" Used for keeping an up-to-date contact list. A callback is added to the returned Deferred that updates the contact list on the factory and also sets my state to STATUS_ONLINE. B{Note}: This is called automatically upon signing in using the version attribute of factory.contacts, so you may want to persist this obje...
def syncList(self, version): """ used for keeping an up-to-date contact list.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
return d def requestListGroups(self): """ Request (forward) list groups. @return: A Deferred, the callback for which will be called when the server responds with the list groups. The callback argument will be a tuple with two elements, a dictionary mapping group IDs to group names and the current list version. """ ...
def _cb(r): self.changeStatus(STATUS_ONLINE) if r[0] is not None: self.factory.contacts = r[0] return r return d.addCallback(_cb)
def syncList(self, version): """ used for keeping an up-to-date contact list.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" Set/change my phone numbers stored on the server. @param phoneType: phoneType can be one of the following constants - HOME_PHONE, WORK_PHONE, MOBILE_PHONE, HAS_PAGER. These are pretty self-explanatory, except maybe HAS_PAGER which refers to whether or not you have a pager. @param value: for all of the *_PHONE con...
""" Set/change my phone numbers stored on the server. @param phoneType: phoneType can be one of the following constants - HOME_PHONE, WORK_PHONE, MOBILE_PHONE, HAS_PAGER. These are pretty self-explanatory, except maybe HAS_PAGER which refers to whether or not you have a pager. @param value: for all of the *_PHONE cons...
def setPhoneDetails(self, phoneType, value): """ Set/change my phone numbers stored on the server.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" used to create a new list group. @param name: The desired name of the new group. @return: A Deferred, the callbacck for which will be called when the server clarifies that the new group has been created. The callback argument will be a tuple with 3 elements: the new list version (int), the new group name (str) a...
""" Used to create a new list group. A default callback is added to the returned Deferred which updates the contacts attribute of the factory. @param name: The desired name of the new group. @return: A Deferred, the callbacck for which will be called when the server clarifies that the new group has been created. The...
def addListGroup(self, name): """ used to create a new list group.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
return d
def _cb(r): self.factory.contacts.version = r[0] self.factory.contacts.setGroup(r[1], r[2]) return r return d.addCallback(_cb)
def addListGroup(self, name): """ used to create a new list group.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" used to remove a list group.
""" Used to remove a list group. A default callback is added to the returned Deferred which updates the contacts attribute of the factory.
def remListGroup(self, groupID): """ used to remove a list group.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
@return: A Deferred, the callback for which will be called when the server clarifies the deletion of the group. The callback argument will be a tuple with 2 elements: the new list version (int) and the group ID (int) of the removed group.
@return: A Deferred, the callback for which will be called when the server clarifies the deletion of the group. The callback argument will be a tuple with 2 elements: the new list version (int) and the group ID (int) of the removed group.
def remListGroup(self, groupID): """ used to remove a list group.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
return d
def _cb(r): self.factory.contacts.version = r[0] self.factory.contacts.remGroup(r[1]) return r return d.addCallback(_cb)
def remListGroup(self, groupID): """ used to remove a list group.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" used to rename an existing list group. @param groupID: the ID of the desired group to rename. @param newName: the desired new name for the group. @return: A Deferred, the callback for which will be called when the server clarifies the renaming. The callback argument will be a tuple of 3 elements, the new list ve...
""" Used to rename an existing list group. A default callback is added to the returned Deferred which updates the contacts attribute of the factory. @param groupID: the ID of the desired group to rename. @param newName: the desired new name for the group. @return: A Deferred, the callback for which will be called whe...
def renameListGroup(self, groupID, newName): """ used to rename an existing list group.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
return d
def _cb(r): self.factory.contacts.version = r[0] self.factory.contacts.setGroup(r[1], r[2]) return r return d.addCallback(_cb)
def renameListGroup(self, groupID, newName): """ used to rename an existing list group.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" used to add a contact to the desired list. @param listType: 2-letter list type (as defined by the *_LIST constants) @param userHandle: the user handle (passport) of the contact that is being added @param groupID: the group ID for which to associate this contact with. (default 0 - no group). Groups are only valid i...
""" Used to add a contact to the desired list. A default callback is added to the returned Deferred which updates the contacts attribute of the factory with the new contact information. @param listType: (as defined by the *_LIST constants) @param userHandle: the user handle (passport) of the contact that is being adde...
def addContact(self, listType, userHandle, groupID=0): """ used to add a contact to the desired list.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
if listType.upper() == "FL":
listType = listIDToCode[listType].upper() if listType == "FL":
def addContact(self, listType, userHandle, groupID=0): """ used to add a contact to the desired list.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
self.sendLine("ADD %s %s %s %s" % (id, listType.upper(), userHandle, userHandle)) return d
self.sendLine("ADD %s %s %s %s" % (id, listType, userHandle, userHandle)) def _cb(r): self.factory.contacts.version = r[2] c = self.factory.contacts.getContact(r[1]) if not c: c = MSNContact(userHandle=r[1]) if r[3]: c.groups.append(r[3]) c.addToList(r[0]) return r return d.addCallback(_cb)
def addContact(self, listType, userHandle, groupID=0): """ used to add a contact to the desired list.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" used to remove a contact from the desired list. @param listType: 2-letter list type (as defined by the *_LIST constants) @param userHandle: the user handle (passport) of the contact being removed @param groupID: the ID of the group to which this contact belongs (only relevant in the forward list, default is 0) @r...
""" Used to remove a contact from the desired list. A default callback is added to the returned deferred which updates the contacts attribute of the factory to reflect the new contact information. @param listType: (as defined by the *_LIST constants) @param userHandle: the user handle (passport) of the contact being r...
def remContact(self, listType, userHandle, groupID=0): """ used to remove a contact from the desired list.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
if listType.upper() == "FL":
listType = listIDToCode[listType].upper() if listType == "FL":
def remContact(self, listType, userHandle, groupID=0): """ used to remove a contact from the desired list.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
self.sendLine("REM %s %s %s" % (id, listType.upper(), userHandle)) return d
self.sendLine("REM %s %s %s" % (id, listType, userHandle)) def _cb(r): l = self.factory.contacts l.version = r[2] c = l.getContact(r[1]) c.removeFromList(r[0]) if c.lists == 0: l.remContact(c.userHandle) return r return d.addCallback(_cb)
def remContact(self, listType, userHandle, groupID=0): """ used to remove a contact from the desired list.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" used to change your current screen name. @param newName: the new screen name @return: A Deferred, the callback for which will be called when the server sends an adequate reply. The callback argument will be a tuple of 2 elements: the new list version and the new screen name.
""" Used to change your current screen name. A default callback is added to the returned Deferred which updates the screenName attribute of the factory and also updates the contact list version. @param newName: the new screen name @return: A Deferred, the callback for which will be called when the server sends an ade...
def changeScreenName(self, newName): """ used to change your current screen name.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
self.sendLine("REA %s %s %s" % (id, self.userHandle, quote(newName))) return d
self.sendLine("REA %s %s %s" % (id, self.factory.userHandle, quote(newName))) def _cb(r): self.factory.contacts.version = r[0] self.factory.screenName = r[1] return r return d.addCallback(_cb)
def changeScreenName(self, newName): """ used to change your current screen name.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" used to request a switchboard server to use for conversations. @return: A Deferred, the callback for which will be called when the server responds with the switchboard information. The callback argument will be a tuple with 3 elements: the host of the switchboard server, the port and a key used for logging in.
""" Used to request a switchboard server to use for conversations. @return: A Deferred, the callback for which will be called when the server responds with the switchboard information. The callback argument will be a tuple with 3 elements: the host of the switchboard server, the port and a key used for logging in.
def requestSwitchboardServer(self): """ used to request a switchboard server to use for conversations.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" used to log out of the notification server. After running the method the server is expected to close the connection.
""" Used to log out of the notification server. After running the method the server is expected to close the connection.
def logOut(self): """ used to log out of the notification server. After running the method the server is expected to close the connection. """ self.sendLine("OUT")
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
class MSNSwitchboardClient(MSNEventBase): """ this class provides support for clients connecting to a switchboard server. Switchboard servers are used for conversations with other people on the MSN network. This means that the number of conversations at any given time will be directly proportional to the number of con...
class NotificationFactory(ClientFactory): """ Factory for the NotificationClient protocol. This is basically responsible for keeping the state of the client and thus should be used in a 1:1 situation with clients. @ivar contacts: An MSNContactList instance reflecting the current contact list -- this is generally kept ...
def logOut(self): """ used to log out of the notification server. After running the method the server is expected to close the connection. """ self.sendLine("OUT")
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" send initial data based on whether we are replying to an invitation or starting one.
""" send initial data based on whether we are replying to an invitation or starting one.
def _sendInit(self): """ send initial data based on whether we are replying to an invitation or starting one. """ id = self._nextTransactionID() if not self.reply: self.sendLine("USR %s %s %s" % (id, self.userHandle, self.key)) else: self.sendLine("ANS %s %s %s %s" % (id, self.userHandle, self.key, self.sessionID))
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" hook for detecting any notification type messages (e.g. file transfer) """
""" hook for detecting any notification type messages (e.g. file transfer) """
def checkMessage(self, message): """ hook for detecting any notification type messages (e.g. file transfer) """ cTypes = [s.lstrip() for s in message.getHeader('Content-Type').split(';')] if self._checkTyping(message, cTypes): return 0 if 'text/x-msmsgsinvite' in cTypes: # header like info is sent as part of the messag...
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
id = int(params[0])
def handle_ANS(self, params): checkParamLen(len(params), 2, 'ANS') id = int(params[0]) if params[1] == "OK": #self._fireCallback(id) self.loggedIn()
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
def handle_ANS(self, params): checkParamLen(len(params), 2, 'ANS') id = int(params[0]) if params[1] == "OK": #self._fireCallback(id) self.loggedIn()
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" called when all login details have been negotiated. Messages can now be sent, or new users invited.
""" called when all login details have been negotiated. Messages can now be sent, or new users invited.
def loggedIn(self): """ called when all login details have been negotiated. Messages can now be sent, or new users invited. """ pass
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" called after connecting to an existing chat session. @param users: A dict mapping usre handles to screen names (current users taking part in the conversation)
""" called after connecting to an existing chat session. @param users: A dict mapping user handles to screen names (current users taking part in the conversation)
def gotChattingUsers(self, users): """ called after connecting to an existing chat session.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" called when a user has joined the conversation. @param userHandle: the user handle (passport) of the user @param screenName: the screen name of the user
""" called when a user has joined the conversation. @param userHandle: the user handle (passport) of the user @param screenName: the screen name of the user
def userJoined(self, userHandle, screenName): """ called when a user has joined the conversation.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" called when a user has left the conversation. @param userHandle: the user handle (passport) of the user.
""" called when a user has left the conversation. @param userHandle: the user handle (passport) of the user.
def userLeft(self, userHandle): """ called when a user has left the conversation.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" called when we receive a message. @param message: the associated MSNMessage object
""" called when we receive a message. @param message: the associated MSNMessage object
def gotMessage(self, message): """ called when we receive a message.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" called when we receive the special type of message notifying us that a user is typing a message. @param message: the associated MSNMessage object
""" called when we receive the special type of message notifying us that a user is typing a message. @param message: the associated MSNMessage object
def userTyping(self, message): """ called when we receive the special type of message notifying us that a user is typing a message.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" called when a contact is trying to send us a file. To accept or reject this transfer see the fileInvitationReply method. @param fileName: the name of the file @param fileSize: the size of the file @param iCookie: the invitation cookie, used so the client can match up your reply with this request. @param message: ...
""" called when a contact is trying to send us a file. To accept or reject this transfer see the fileInvitationReply method. @param fileName: the name of the file @param fileSize: the size of the file @param iCookie: the invitation cookie, used so the client can match up your reply with this request. @param message: t...
def gotSendRequest(self, fileName, fileSize, iCookie, message): """ called when a contact is trying to send us a file. To accept or reject this transfer see the fileInvitationReply method.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" used to invite a user to the current switchboard server. @param userHandle: the user handle (passport) of the desired user. @return: A Deferred, the callback for which will be called when the server notifies us that the user has indeed been invited. The callback argument will be a tuple with 1 element, the sessi...
""" used to invite a user to the current switchboard server. @param userHandle: the user handle (passport) of the desired user. @return: A Deferred, the callback for which will be called when the server notifies us that the user has indeed been invited. The callback argument will be a tuple with 1 element, the sessi...
def inviteUser(self, userHandle): """ used to invite a user to the current switchboard server.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" used to send a message. @param message: the corresponding MSNMessage object. @return: Depending on the value of message.ack. If set to MSNMessage.MESSAGE_ACK or MSNMessage.MESSAGE_NACK a Deferred will be returned, the callback for which will be fired when an ACK or NCK is received - the callback argument will be...
""" used to send a message. @param message: the corresponding MSNMessage object. @return: Depending on the value of message.ack. If set to MSNMessage.MESSAGE_ACK or MSNMessage.MESSAGE_NACK a Deferred will be returned, the callback for which will be fired when an ACK or NACK is received - the callback argument will be...
def sendMessage(self, message): """ used to send a message.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" used to send a typing notification. Upon receiving this message the official client will display a 'user is typing' message to all other users in the chat session for 10 seconds. The official client sends one of these every 5 seconds (I think) as long as you continue to type.
""" used to send a typing notification. Upon receiving this message the official client will display a 'user is typing' message to all other users in the chat session for 10 seconds. The official client sends one of these every 5 seconds (I think) as long as you continue to type.
def sendTypingNotification(self): """ used to send a typing notification. Upon receiving this message the official client will display a 'user is typing' message to all other users in the chat session for 10 seconds. The official client sends one of these every 5 seconds (I think) as long as you continue to type. """...
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" send an notification that we want to send a file. @param fileName: the file name @param fileSize: the file size @return: A Deferred, the callback of which will be fired when the user responds to this invitation with an appropriate message. The callback argument will be a tuple with 3 elements, the first being 1 ...
""" send an notification that we want to send a file. @param fileName: the file name @param fileSize: the file size @return: A Deferred, the callback of which will be fired when the user responds to this invitation with an appropriate message. The callback argument will be a tuple with 3 elements, the first being 1 o...
def sendFileInvitation(self, fileName, fileSize): """ send an notification that we want to send a file.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" used to reply to a file transfer invitation. @param iCookie: the invitation cookie of the initial invitation @param accept: whether or not you accept this transfer, 1 = yes, 0 = no, default = 1. @return: A Deferred, the callback for which will be fired when the user responds with the transfer information. The cal...
""" used to reply to a file transfer invitation. @param iCookie: the invitation cookie of the initial invitation @param accept: whether or not you accept this transfer, 1 = yes, 0 = no, default = 1. @return: A Deferred, the callback for which will be fired when the user responds with the transfer information. The cal...
def fileInvitationReply(self, iCookie, accept=1): """ used to reply to a file transfer invitation.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" send information relating to a file transfer session. @param accept: whether or not to go ahead with the transfer (1=yes, 0=no) @param iCookie: the invitation cookie of previous replies relating to this transfer @param authCookie: the authentication cookie obtained from an MSNFileSend instance @param ip: your ip @...
""" send information relating to a file transfer session. @param accept: whether or not to go ahead with the transfer (1=yes, 0=no) @param iCookie: the invitation cookie of previous replies relating to this transfer @param authCookie: the authentication cookie obtained from an FileSend instance @param ip: your ip @par...
def sendTransferInfo(self, accept, iCookie, authCookie, ip, port): """ send information relating to a file transfer session.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
class MSNFileReceive(LineReceiver): """ This class provides support for receiving files from contacts. @ivar fileSize: the size of the receiving file. (you will have to set this) @ivar connected: true if a connection has been established. @ivar completed: true if the transfer is complete. @ivar bytesReceived: number o...
class FileReceive(LineReceiver): """ This class provides support for receiving files from contacts. @ivar fileSize: the size of the receiving file. (you will have to set this) @ivar connected: true if a connection has been established. @ivar completed: true if the transfer is complete. @ivar bytesReceived: number of b...
def sendTransferInfo(self, accept, iCookie, authCookie, ip, port): """ send information relating to a file transfer session.
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" @param auth: auth string received in the file invitation. @param myUserHandle: your userhandle. @param file: A string or file object represnting the file to save data to. @param directory: optional parameter specifiying the directory. Defaults to the current directory. @param overwrite: if true and a file of the sa...
""" @param auth: auth string received in the file invitation. @param myUserHandle: your userhandle. @param file: A string or file object represnting the file to save data to. @param directory: optional parameter specifiying the directory. Defaults to the current directory. @param overwrite: if true and a file of the sa...
def __init__(self, auth, myUserHandle, file, directory="", overwrite=0): """ @param auth: auth string received in the file invitation. @param myUserHandle: your userhandle. @param file: A string or file object represnting the file to save data to. @param directory: optional parameter specifiying the directory. Defaults...
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
class MSNFileSend(LineReceiver): """ This class provides support for sending files to other contacts. @ivar bytesSent: the number of bytes that have currently been sent. @ivar completed: true if the send has completed. @ivar connected: true if a connection has been established. @ivar targetUser: the target user (conta...
class FileSend(LineReceiver): """ This class provides support for sending files to other contacts. @ivar bytesSent: the number of bytes that have currently been sent. @ivar completed: true if the send has completed. @ivar connected: true if a connection has been established. @ivar targetUser: the target user (contact)...
def gotSegment(self, data): """ called when a segment (block) of data arrives. """ self.file.write(data)
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
""" @param file: A string or file object represnting the file to send.
""" @param file: A string or file object represnting the file to send.
def __init__(self, file): """ @param file: A string or file object represnting the file to send. """
9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py
for group in self._ingroups[nickname]: self.getGroupConversation(group).memberLeft(nickname) self._ingroups[nickname]=[]
if self._ingroups.has_key(nickname): for group in self._ingroups[nickname]: self.getGroupConversation(group).memberLeft(nickname) self._ingroups[nickname]=[] else: print '*** WARNING: ingroups had no such key %s' % nickname
def irc_QUIT(self,prefix,params): nickname=string.split(prefix,"!")[0] for group in self._ingroups[nickname]: self.getGroupConversation(group).memberLeft(nickname) self._ingroups[nickname]=[]
860724de17fd736aa12d0bf11e2a6d6b14d460c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/860724de17fd736aa12d0bf11e2a6d6b14d460c9/ircsupport.py
a = cPickle.load(open(options['append'], 'rb'))
if os.path.exists(options['append']): a = cPickle.load(open(options['append'], 'rb')) else: a = app.Application(options.subCommand, int(options['uid']), int(options['gid']))
def run(): tapLookup = loadPlugins() options = GeneralOptions(tapLookup) if hasattr(os, 'getgid'): options['uid'] = os.getuid() options['gid'] = os.getgid() try: options.parseOptions(sys.argv[1:]) # XXX - Yea, this is FILTH FILTH FILTH if options['debug'] or options['progress']: tapLookup = loadPlugins(options['debug']...
2016c58f385d5769a86f9451621f4e82bb6f53a0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/2016c58f385d5769a86f9451621f4e82bb6f53a0/mktap.py
for doc in (template, document): fixLinks(doc, ext)
fixLinks(document, ext)
def munge(document, template, linkrel, d, fullpath, ext, cache): addMtime(template, fullpath) # things linked from the top for list in (domhelpers.findElementsWithAttribute(template,"src"), domhelpers.findElementsWithAttribute(template,"href"), domhelpers.findElementsWithAttribute(document, "fromtop")): fixFromTop(list...
b9acebf4c9c2e4c3a27d489338bc01f803dbc75d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/b9acebf4c9c2e4c3a27d489338bc01f803dbc75d/tree.py
"unix": _parseUNIX, "ssl": _parseSSL}
"unix": _parseUNIX, "ssl": _parseSSL}
def _parseSSL(factory, port, privateKey="server.pem", certKey=None, sslmethod=None, interface='', backlog=5): from twisted.internet import ssl if certKey is None: certKey = privateKey kw = {} if sslmethod is not None: kw['sslmethod'] = getattr(ssl.SSL, sslmethod) cf = ssl.DefaultOpenSSLContextFactory(privateKey, certKe...
df986ee18041a7d99090ec7e5d4c02586841ba31 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/df986ee18041a7d99090ec7e5d4c02586841ba31/ports.py
if len(args)==1:
if len(args)==1 and not kw:
def parse(description, factory, default=None): """Parse a description of a reliable virtual circuit server @type description: C{str} @type factory: C{twisted.internet.interfaces.IProtocolFactory} @type default: C{str} or C{None} @rtype: C{tuple} @return: a tuple of string, tuple and dictionary. The string is the name ...
df986ee18041a7d99090ec7e5d4c02586841ba31 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/df986ee18041a7d99090ec7e5d4c02586841ba31/ports.py
print '*************' print '\n'.join(lines) print '*************'
def testTracebackReporting(self): self.suite.addMethod(common.FailfulTests.testTracebackReporting) self.suite.run() lines = self.reporter.out.split('\n') while 1: if not lines: raise FailTest, "DOUBLE_SEPARATOR not found in lines" if lines[0] != DOUBLE_SEPARATOR: lines.pop(0) else: return
ca017dfa7abb3d3d3c0673d74f05bae18ef00537 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/ca017dfa7abb3d3d3c0673d74f05bae18ef00537/test_reporter.py
def startLogging(logfilename, syslog, prefix, nodaemon):
def startLogging(logfilename, sysLog, prefix, nodaemon):
def startLogging(logfilename, syslog, prefix, nodaemon): if logfilename == '-': if not nodaemon: print 'daemons cannot log to stdout' os._exit(1) logFile = sys.stdout elif nodaemon and not logfilename: logFile = sys.stdout elif syslog: syslog.startLogging(prefix) else: logPath = os.path.abspath(logfilename or 'twistd.l...
307b350fc0bbfaaeeffa9bd0291cf743facf7c3f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/307b350fc0bbfaaeeffa9bd0291cf743facf7c3f/twistd3.py
elif syslog:
elif sysLog:
def startLogging(logfilename, syslog, prefix, nodaemon): if logfilename == '-': if not nodaemon: print 'daemons cannot log to stdout' os._exit(1) logFile = sys.stdout elif nodaemon and not logfilename: logFile = sys.stdout elif syslog: syslog.startLogging(prefix) else: logPath = os.path.abspath(logfilename or 'twistd.l...
307b350fc0bbfaaeeffa9bd0291cf743facf7c3f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/307b350fc0bbfaaeeffa9bd0291cf743facf7c3f/twistd3.py
if not syslog:
if not sysLog:
def rotateLog(signal, frame, logFile=logFile): from twisted.internet import reactor reactor.callLater(0, logFile.rotate)
307b350fc0bbfaaeeffa9bd0291cf743facf7c3f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/307b350fc0bbfaaeeffa9bd0291cf743facf7c3f/twistd3.py
def sibLink(req, name): "Return the text that links to a sibling of the requested resource." if req.postpath: return (len(req.postpath)*"../") + name else: return name
rpyNoResource = """<p>You forgot to assign to the variable "resource" in your script. For example:</p> <pre>
def sibLink(req, name): "Return the text that links to a sibling of the requested resource." if req.postpath: return (len(req.postpath)*"../") + name else: return name
a6f9b1004d2fe42a11a3c1e0fb62efa3b08afccc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/a6f9b1004d2fe42a11a3c1e0fb62efa3b08afccc/requtil.py
def childLink(req, name): "Return the text that links to a child of the requested resource." lpp = len(req.postpath) if lpp > 1: return ((lpp-1)*"../") + name if lpp == 1: return name if len(req.prepath) and req.prepath[-1]: return req.prepath[-1] + '/' + name else: return name
import mygreatresource
def childLink(req, name): "Return the text that links to a child of the requested resource." lpp = len(req.postpath) if lpp > 1: return ((lpp-1)*"../") + name if lpp == 1: return name if len(req.prepath) and req.prepath[-1]: return req.prepath[-1] + '/' + name else: return name
a6f9b1004d2fe42a11a3c1e0fb62efa3b08afccc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/a6f9b1004d2fe42a11a3c1e0fb62efa3b08afccc/requtil.py
class IAppRoot(Interface): """attribute: root"""
resource = mygreatresource.MyGreatResource() </pre> """
def childLink(req, name): "Return the text that links to a child of the requested resource." lpp = len(req.postpath) if lpp > 1: return ((lpp-1)*"../") + name if lpp == 1: return name if len(req.prepath) and req.prepath[-1]: return req.prepath[-1] + '/' + name else: return name
a6f9b1004d2fe42a11a3c1e0fb62efa3b08afccc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/a6f9b1004d2fe42a11a3c1e0fb62efa3b08afccc/requtil.py
class AppRoot: implements(IAppRoot) def __init__(self, request): url = prePathURL(request) self.root = url[:url.rindex("/")]
class AlreadyCached(Exception): """This exception is raised when a path has already been cached. """
def childLink(req, name): "Return the text that links to a child of the requested resource." lpp = len(req.postpath) if lpp > 1: return ((lpp-1)*"../") + name if lpp == 1: return name if len(req.prepath) and req.prepath[-1]: return req.prepath[-1] + '/' + name else: return name
a6f9b1004d2fe42a11a3c1e0fb62efa3b08afccc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/a6f9b1004d2fe42a11a3c1e0fb62efa3b08afccc/requtil.py
components.registerAdapter(AppRoot, iweb.IRequest, IAppRoot)
class CacheScanner(object): def __init__(self, path, registry): self.path = path self.registry = registry self.doCache = 0
def __init__(self, request): url = prePathURL(request) self.root = url[:url.rindex("/")]
a6f9b1004d2fe42a11a3c1e0fb62efa3b08afccc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/a6f9b1004d2fe42a11a3c1e0fb62efa3b08afccc/requtil.py
class ISession(Interface): pass
def cache(self): c = self.registry.getCachedPath(self.path) if c is not None: raise AlreadyCached(c) self.recache()
def __init__(self, request): url = prePathURL(request) self.root = url[:url.rindex("/")]
a6f9b1004d2fe42a11a3c1e0fb62efa3b08afccc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/a6f9b1004d2fe42a11a3c1e0fb62efa3b08afccc/requtil.py
def getSession(request): cookiename = "_".join(['TWISTED_SESSION'] + self.sitepath) sessionCookie = request.getCookie(cookiename) if sessionCookie: try: return request.site.getSession(sessionCookie) except KeyError: pass session = Session(request.site, request.site.mkuid()) site.setSession(session) request.addCookie(co...
def recache(self): self.doCache = 1
def getSession(request): cookiename = "_".join(['TWISTED_SESSION'] + self.sitepath) sessionCookie = request.getCookie(cookiename) if sessionCookie: try: return request.site.getSession(sessionCookie) except KeyError: pass session = Session(request.site, request.site.mkuid()) site.setSession(session) request.addCookie(co...
a6f9b1004d2fe42a11a3c1e0fb62efa3b08afccc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/a6f9b1004d2fe42a11a3c1e0fb62efa3b08afccc/requtil.py
components.registerAdapter(getSession, iweb.IRequest, ISession)
noRsrc = error.ErrorPage(500, "Whoops! Internal Error", rpyNoResource)
def getSession(request): cookiename = "_".join(['TWISTED_SESSION'] + self.sitepath) sessionCookie = request.getCookie(cookiename) if sessionCookie: try: return request.site.getSession(sessionCookie) except KeyError: pass session = Session(request.site, request.site.mkuid()) site.setSession(session) request.addCookie(co...
a6f9b1004d2fe42a11a3c1e0fb62efa3b08afccc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/a6f9b1004d2fe42a11a3c1e0fb62efa3b08afccc/requtil.py
def prePathURL(request): port = request.getHost().port if request.isSecure(): default = 443 else: default = 80 if port == default: hostport = '' else: hostport = ':%d' % port return urllib.quote('http%s://%s%s/%s' % ( request.isSecure() and 's' or '', request.getRequestHostname(), hostport, '/'.join(request.prepath)), ...
def ResourceScript(path, registry): """ I am a normal py file which must define a 'resource' global, which should be an instance of (a subclass of) web.resource.Resource; it will be renderred. """ cs = CacheScanner(path, registry) glob = {'__file__': path, 'resource': noRsrc, 'registry': registry, 'cache': cs.cache, 'r...
def prePathURL(request): port = request.getHost().port if request.isSecure(): default = 443 else: default = 80 if port == default: hostport = '' else: hostport = ':%d' % port return urllib.quote('http%s://%s%s/%s' % ( request.isSecure() and 's' or '', request.getRequestHostname(), hostport, '/'.join(request.prepath)), ...
a6f9b1004d2fe42a11a3c1e0fb62efa3b08afccc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/a6f9b1004d2fe42a11a3c1e0fb62efa3b08afccc/requtil.py
def URLPath(request): from twisted.python import urlpath return urlpath.URLPath.fromString(prePathURL(request))
def ResourceTemplate(path, registry): from quixote import ptl_compile
def URLPath(request): from twisted.python import urlpath return urlpath.URLPath.fromString(prePathURL(request))
a6f9b1004d2fe42a11a3c1e0fb62efa3b08afccc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/a6f9b1004d2fe42a11a3c1e0fb62efa3b08afccc/requtil.py
class Session(components.Componentized): """A user's session with a system.
glob = {'__file__': path, 'resource': error.ErrorPage(500, "Whoops! Internal Error", rpyNoResource), 'registry': registry}
def URLPath(request): from twisted.python import urlpath return urlpath.URLPath.fromString(prePathURL(request))
a6f9b1004d2fe42a11a3c1e0fb62efa3b08afccc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/a6f9b1004d2fe42a11a3c1e0fb62efa3b08afccc/requtil.py
This utility class contains only timeout functionality, but is used to represent a session. """ timeout = 15*60
e = ptl_compile.compile_template(open(path), path) exec e in glob return glob['resource']
def URLPath(request): from twisted.python import urlpath return urlpath.URLPath.fromString(prePathURL(request))
a6f9b1004d2fe42a11a3c1e0fb62efa3b08afccc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/a6f9b1004d2fe42a11a3c1e0fb62efa3b08afccc/requtil.py
def __init__(self, site, uid): """Initialize a session with a unique ID for that session. """ components.Componentized.__init__(self) self.site = site self.uid = uid self.expireCallbacks = [] self.touch() self.sessionNamespaces = {} reactor.callLater(self.timeout, self._checkExpired)
def __init__(self, site, uid): """Initialize a session with a unique ID for that session. """ components.Componentized.__init__(self) self.site = site self.uid = uid self.expireCallbacks = [] self.touch() self.sessionNamespaces = {} reactor.callLater(self.timeout, self._checkExpired)
a6f9b1004d2fe42a11a3c1e0fb62efa3b08afccc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/a6f9b1004d2fe42a11a3c1e0fb62efa3b08afccc/requtil.py
def notifyOnExpire(self): """Call this callback when the session expires or logs out. """ self.expireCallbacks.append(defer.Deferred()) return self.expireCallbacks[-1]
class ResourceScriptWrapper(resource.Resource):
def notifyOnExpire(self): """Call this callback when the session expires or logs out. """ self.expireCallbacks.append(defer.Deferred()) return self.expireCallbacks[-1]
a6f9b1004d2fe42a11a3c1e0fb62efa3b08afccc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/a6f9b1004d2fe42a11a3c1e0fb62efa3b08afccc/requtil.py
def expire(self): """Expire/logout of the session. """ del self.site.sessions[self.uid] for c in self.expireCallbacks: c.callback(self) self.expireCallbacks = []
def __init__(self, path, registry=None): resource.Resource.__init__(self) self.path = path self.registry = registry or static.Registry()
def expire(self): """Expire/logout of the session. """ #log.msg("expired session %s" % self.uid) del self.site.sessions[self.uid] for c in self.expireCallbacks: c.callback(self) self.expireCallbacks = []
a6f9b1004d2fe42a11a3c1e0fb62efa3b08afccc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/a6f9b1004d2fe42a11a3c1e0fb62efa3b08afccc/requtil.py
def touch(self): self.lastModified = time.time()
def render(self, request): res = ResourceScript(self.path, self.registry) return res.render(request)
def touch(self): self.lastModified = time.time()
a6f9b1004d2fe42a11a3c1e0fb62efa3b08afccc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/a6f9b1004d2fe42a11a3c1e0fb62efa3b08afccc/requtil.py
if not groupID:
if groupID is None:
def addItemSSI(self, item, groupID = None, buddyID = None): """ add an item to the SSI server. if buddyID == 0, then this should be a group. this gets a callback when it's finished, but you can probably ignore it. """ if not groupID: groupID = item.group.group.findIDFor(item.group) if not buddyID: buddyID = item.group...
5dba0eba9ad679b5e21261a0576b4eeef14b42aa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/5dba0eba9ad679b5e21261a0576b4eeef14b42aa/oscar.py
if not buddyID:
if buddyID is None:
def addItemSSI(self, item, groupID = None, buddyID = None): """ add an item to the SSI server. if buddyID == 0, then this should be a group. this gets a callback when it's finished, but you can probably ignore it. """ if not groupID: groupID = item.group.group.findIDFor(item.group) if not buddyID: buddyID = item.group...
5dba0eba9ad679b5e21261a0576b4eeef14b42aa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/5dba0eba9ad679b5e21261a0576b4eeef14b42aa/oscar.py
if not groupID:
if groupID is None:
def modifyItemSSI(self, item, groupID = None, buddyID = None): if not groupID: groupID = item.group.group.findIDFor(item.group) if not buddyID: buddyID = item.group.findIDFor(item) return self.sendSNAC(0x13,0x09, item.oscarRep(groupID, buddyID))
5dba0eba9ad679b5e21261a0576b4eeef14b42aa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/5dba0eba9ad679b5e21261a0576b4eeef14b42aa/oscar.py
if not buddyID:
if buddyID is None:
def modifyItemSSI(self, item, groupID = None, buddyID = None): if not groupID: groupID = item.group.group.findIDFor(item.group) if not buddyID: buddyID = item.group.findIDFor(item) return self.sendSNAC(0x13,0x09, item.oscarRep(groupID, buddyID))
5dba0eba9ad679b5e21261a0576b4eeef14b42aa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/5dba0eba9ad679b5e21261a0576b4eeef14b42aa/oscar.py
if not groupID:
if groupID is None:
def delItemSSI(self, item, groupID = None, buddyID = None): if not groupID: groupID = item.group.group.findIDFor(item.group) if not buddyID: buddyID = item.group.findIDFor(item) return self.sendSNAC(0x13,0x0A, item.oscarRep(groupID, buddyID))
5dba0eba9ad679b5e21261a0576b4eeef14b42aa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/5dba0eba9ad679b5e21261a0576b4eeef14b42aa/oscar.py
if not buddyID:
if buddyID is None:
def delItemSSI(self, item, groupID = None, buddyID = None): if not groupID: groupID = item.group.group.findIDFor(item.group) if not buddyID: buddyID = item.group.findIDFor(item) return self.sendSNAC(0x13,0x0A, item.oscarRep(groupID, buddyID))
5dba0eba9ad679b5e21261a0576b4eeef14b42aa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/5dba0eba9ad679b5e21261a0576b4eeef14b42aa/oscar.py
if self.profile:
if self.profile is not None:
def setProfile(self, profile): """ set the profile. send None to not set a profile (different from '' for a blank one) """ self.profile = profile tlvs = '' if self.profile: tlvs = TLV(1,'text/aolrtf; charset="us-ascii"') + \ TLV(2,self.profile)
5dba0eba9ad679b5e21261a0576b4eeef14b42aa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/5dba0eba9ad679b5e21261a0576b4eeef14b42aa/oscar.py