Exemple #1
0
 def __init__(self, p2p, filename):
     Base.__init__(self, p2p)
     self.app_id = '2' 
     self.context = FTContext()
     self.context.filename = filename
     self.context.file_size = os.stat(filename).st_size
     self.data = open(filename, "rb")
     self.connect_handler(p2p)
     self.current_transfer = 0
     message = msn_slp.invite(self, base64.b64encode(str(self.context)),
         msn_slp.SLPMessage.EUFGUID_FILE)
     self.emit('msnp2p-message-ready', message, 0)
Exemple #2
0
 def __init__(self, p2p, msnobj):
     '''p2p is a P2PUser, msnobj is a Msnobj'''
     if p2p.last_requested_msnobj == msnobj:
         return
     Base.__init__(self, p2p)
     p2p.last_requested_msnobj = msnobj
     self.msnobj = msnobj
     if self.msnobj.type == Msnobj.Msnobj.DISPLAY_PICTURE:
         self.app_id = '1' 
     elif self.msnobj.type == Msnobj.Msnobj.CUSTOM_EMOTICON:
         self.app_id = '12' 
     self.connect_handler(p2p)
     context = base64.b64encode(str(msnobj) + '\0')
     self.emit('msnp2p-message-ready', msn_slp.invite(self, context), 0)