diff src/plugins/plugin_xep_0095.py @ 394:8f3551ceee17

plugin XEP-0065: refactored and misc stuff fixed. Still not finished plugins XEP-0096: XEP-0065 (Socks5 stream method) managed
author Goffi <goffi@goffi.org>
date Mon, 03 Oct 2011 18:05:15 +0200
parents c34fd9d6242e
children cb0285372818
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0095.py	Sun Oct 02 00:29:04 2011 +0200
+++ b/src/plugins/plugin_xep_0095.py	Mon Oct 03 18:05:15 2011 +0200
@@ -86,38 +86,38 @@
             #We don't know this profile, we send an error
             self.sendBadProfileError(iq_el['id'], iq_el['from'], profile)
 
-    def sendRejectedError(self, id, to_jid, reason = 'Offer Declined', profile='@NONE@'):
+    def sendRejectedError(self, iq_id, to_jid, reason = 'Offer Declined', profile='@NONE@'):
         """Helper method to send when the stream is rejected
-        @param id: IQ id
+        @param iq_id: IQ id
         @param to_jid: recipient
         @param reason: human readable reason (string)
         @param profile: %(doc_profile)s"""
-        self.sendError(id, to_jid, 403, 'cancel', {'text':reason}, profile=profile)
+        self.sendError(iq_id, to_jid, 403, 'cancel', {'text':reason}, profile=profile)
 
-    def sendBadProfileError(self, id, to_jid, profile):
+    def sendBadProfileError(self, iq_id, to_jid, profile):
         """Helper method to send when we don't know the SI profile
-        @param id: IQ id
+        @param iq_id: IQ id
         @param to_jid: recipient
         @param profile: %(doc_profile)s"""
-        self.sendError(id, to_jid, 400, 'modify', profile=profile)
+        self.sendError(iq_id, to_jid, 400, 'modify', profile=profile)
 
-    def sendBadRequestError(self, id, to_jid, profile):
+    def sendBadRequestError(self, iq_id, to_jid, profile):
         """Helper method to send when we don't know the SI profile
-        @param id: IQ id
+        @param iq_id: IQ id
         @param to_jid: recipient
         @param profile: %(doc_profile)s"""
-        self.sendError(id, to_jid, 400, 'cancel', profile=profile)
+        self.sendError(iq_id, to_jid, 400, 'cancel', profile=profile)
     
-    def sendFailedError(self, id, to_jid, profile):
+    def sendFailedError(self, iq_id, to_jid, profile):
         """Helper method to send when we transfer failed
-        @param id: IQ id
+        @param iq_id: IQ id
         @param to_jid: recipient
         @param profile: %(doc_profile)s"""
-        self.sendError(id, to_jid, 500, 'cancel', {'custom':'failed'}, profile=profile) #as there is no error code for failed transfer, we use 500 (undefined-condition)
+        self.sendError(iq_id, to_jid, 500, 'cancel', {'custom':'failed'}, profile=profile) #as there is no error code for failed transfer, we use 500 (undefined-condition)
     
-    def sendError(self, id, to_jid, err_code, err_type='cancel', data={}, profile='@NONE@'):
+    def sendError(self, iq_id, to_jid, err_code, err_type='cancel', data={}, profile='@NONE@'):
         """Send IQ error as a result
-        @param id: IQ id
+        @param iq_id: IQ id
         @param to_jid: recipient
         @param err_code: error err_code (see XEP-0095 #4.2)
         @param err_type: one of cancel, modify
@@ -128,7 +128,7 @@
         assert(client)
         result = domish.Element(('', 'iq'))
         result['type'] = 'result'
-        result['id'] = id
+        result['id'] = iq_id
         result['to'] = to_jid 
         error_el = result.addElement('error')
         error_el['err_code'] =  str(err_code)
@@ -150,9 +150,9 @@
 
         client.xmlstream.send(result)
 
-    def acceptStream(self, id, to_jid, feature_elt, misc_elts=[], profile='@NONE@'):
+    def acceptStream(self, iq_id, to_jid, feature_elt, misc_elts=[], profile='@NONE@'):
         """Send the accept stream initiation answer
-        @param id: stream initiation id
+        @param iq_id: IQ id
         @param feature_elt: domish element 'feature' containing stream method to use
         @param misc_elts: list of domish element to add
         @param profile: %(doc_profile)s"""
@@ -161,7 +161,7 @@
         info (_("sending stream initiation accept answer"))
         result = domish.Element(('', 'iq'))
         result['type'] = 'result'
-        result['id'] = id
+        result['id'] = iq_id
         result['to'] = to_jid 
         si = result.addElement('si', NS_SI)
         si.addChild(feature_elt)