diff src/plugins/plugin_xep_0047.py @ 587:952322b1d490

Remove trailing whitespaces.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 18 Jan 2013 17:55:34 +0100
parents 9902ec2d8d9b
children beaf6bec2fcd
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0047.py	Fri Jan 18 17:55:27 2013 +0100
+++ b/src/plugins/plugin_xep_0047.py	Fri Jan 18 17:55:34 2013 +0100
@@ -72,13 +72,13 @@
         if not client:
             raise ProfileNotInCacheError
         client.xep_0047_current_stream = {} #key: stream_id, value: data(dict)
-    
+
     def _timeOut(self, sid, profile):
         """Delecte current_stream id, called after timeout
         @param id: id of client.xep_0047_current_stream"""
         info(_("In-Band Bytestream: TimeOut reached for id %s [%s]") % (sid, profile))
         self._killId(sid, False, "TIMEOUT", profile)
-    
+
     def _killId(self, sid, success=False, failure_reason="UNKNOWN", profile=None):
         """Delete an current_stream id, clean up associated observers
         @param sid: id of client.xep_0047_current_stream"""
@@ -96,18 +96,18 @@
             client.xep_0047_current_stream[sid]['timer'].cancel()
         if client.xep_0047_current_stream[sid].has_key("size"):
             self.host.removeProgressCB(sid, profile)
-       
+
         file_obj = client.xep_0047_current_stream[sid]['file_obj']
         success_cb = client.xep_0047_current_stream[sid]['success_cb']
         failure_cb = client.xep_0047_current_stream[sid]['failure_cb']
-        
+
         del client.xep_0047_current_stream[sid]
 
         if success:
             success_cb(sid, file_obj, NS_IBB, profile)
         else:
             failure_cb(sid, file_obj, NS_IBB, failure_reason, profile)
-    
+
     def getProgress(self, sid, data, profile):
         """Fill data with position of current transfer"""
         client = self.host.getClient(profile)
@@ -119,7 +119,7 @@
             data["size"] = str(client.xep_0047_current_stream[sid]["size"])
         except:
             pass
-    
+
     def prepareToReceive(self, from_jid, sid, file_obj, size, success_cb, failure_cb, profile):
         """Called when a bytestream is imminent
         @param from_jid: jid of the sender
@@ -174,7 +174,7 @@
 
         #we save the xmlstream, events and observer data to allow observer removal
         client.xep_0047_current_stream[sid]["event_data"] = event_data = (IBB_MESSAGE_DATA if stanza=='message' else IBB_IQ_DATA) % sid
-        client.xep_0047_current_stream[sid]["observer_cb"] = observer_cb = self.messageData if stanza=='message' else self.iqData 
+        client.xep_0047_current_stream[sid]["observer_cb"] = observer_cb = self.messageData if stanza=='message' else self.iqData
         event_close = IBB_CLOSE % sid
         #we now set the stream observer to look after data packet
         client.xmlstream.addObserver(event_data, observer_cb, profile = profile)
@@ -207,16 +207,16 @@
         if not client:
             raise ProfileNotInCacheError
         data_elt = IQ.firstChildElement()
-        
+
         if self._manageDataElt(data_elt, 'iq', IQ['id'], jid.JID(IQ['from']), profile):
             #and send a success answer
             result = domish.Element((None, 'iq'))
             result['type'] = 'result'
             result['id'] = IQ['id']
             result['to'] = IQ['from']
-            
+
             client.xmlstream.send(result)
-   
+
     def messageData(self, message_elt, profile):
         data_elt = message_elt.firstChildElement()
         sid = message_elt.getAttribute('id','')
@@ -272,7 +272,7 @@
         result = domish.Element((None, 'iq'))
         result['type'] = 'result'
         result['id'] = iq_id
-        result['to'] = to_jid 
+        result['to'] = to_jid
         error_el = result.addElement('error')
         error_el['type'] = 'cancel'
         error_el.addElement(('urn:ietf:params:xml:ns:xmpp-stanzas','not-acceptable'))
@@ -323,10 +323,10 @@
             warning(_("Transfer failed"))
             self.terminateStream(sid, "IQ_ERROR")
             return
-        
+
         if data['timer'].active():
             data['timer'].cancel()
-        
+
         buffer = data["file_obj"].read(data["block_size"])
         if buffer:
             next_iq_elt = jabber_client.IQ(client.xmlstream,'set')
@@ -366,10 +366,10 @@
 
 class XEP_0047_handler(XMPPHandler):
     implements(iwokkel.IDisco)
-    
+
     def __init__(self,parent):
         self.plugin_parent = parent
-    
+
     def connectionInitialized(self):
         self.xmlstream.addObserver(IBB_OPEN, self.plugin_parent.streamOpening, profile = self.parent.profile)