diff --git a/src/common/gajim.py b/src/common/gajim.py index 139bb3352afbdaf29cf5053f59f2e15ee2753c9a..8819e8243cf2eeba62237ce324b88edba528a4a6 100644 --- a/src/common/gajim.py +++ b/src/common/gajim.py @@ -256,12 +256,11 @@ def get_resource_from_jid(jid): return jids[1] # abc@doremi.org/res/res-continued else: return '' - '''\ -[15:34:28] <asterix> we should add contact.fake_jid I think -[15:34:46] <asterix> so if we know real jid, it wil be in contact.jid, or we look in contact.fake_jid -[15:32:54] <asterix> they can have resource if we know the real jid -[15:33:07] <asterix> and that resource is in contact.resource -''' + +# [15:34:28] <asterix> we should add contact.fake_jid I think +# [15:34:46] <asterix> so if we know real jid, it wil be in contact.jid, or we look in contact.fake_jid +# [15:32:54] <asterix> they can have resource if we know the real jid +# [15:33:07] <asterix> and that resource is in contact.resource def get_number_of_accounts(): '''returns the number of ALL accounts''' diff --git a/src/common/xmpp/debug.py b/src/common/xmpp/debug.py index 3450e39665c36bee63c22d4a94a6cbb9d0a6e2a8..640f520bde280e40df0e2fcff12fe77a83c091d5 100644 --- a/src/common/xmpp/debug.py +++ b/src/common/xmpp/debug.py @@ -12,10 +12,7 @@ ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU Lesser General Public License for more details. -_version_ = '1.4.0' - -"""\ - +""" Generic debug class Other modules can always define extra debug flags for local usage, as long as @@ -34,9 +31,9 @@ by the individual classes. For samples of usage, see samples subdir in distro source, and selftest in this code - """ +_version_ = '1.4.0' import sys @@ -70,36 +67,34 @@ color_bright_cyan = chr(27) + "[36;1m" color_white = chr(27) + "[37;1m" -""" -Define your flags in yor modules like this: - -from debug import * - -DBG_INIT = 'init' ; debug_flags.append( DBG_INIT ) -DBG_CONNECTION = 'connection' ; debug_flags.append( DBG_CONNECTION ) - - The reason for having a double statement wis so we can validate params - and catch all undefined debug flags - - This gives us control over all used flags, and makes it easier to allow - global debugging in your code, just do something like - - foo = Debug( debug_flags ) - - group flags, that is a flag in it self containing multiple flags should be - defined without the debug_flags.append() sequence, since the parts are already - in the list, also they must of course be defined after the flags they depend on ;) - example: - -DBG_MULTI = [ DBG_INIT, DBG_CONNECTION ] - - - - NoDebug - ------- - To speed code up, typically for product releases or such - use this class instead if you globaly want to disable debugging -""" +# Define your flags in yor modules like this: +# +# from debug import * +# +# DBG_INIT = 'init' ; debug_flags.append( DBG_INIT ) +# DBG_CONNECTION = 'connection' ; debug_flags.append( DBG_CONNECTION ) +# +# The reason for having a double statement wis so we can validate params +# and catch all undefined debug flags +# +# This gives us control over all used flags, and makes it easier to allow +# global debugging in your code, just do something like +# +# foo = Debug( debug_flags ) +# +# group flags, that is a flag in it self containing multiple flags should be +# defined without the debug_flags.append() sequence, since the parts are already +# in the list, also they must of course be defined after the flags they depend on ;) +# example: +# +# DBG_MULTI = [ DBG_INIT, DBG_CONNECTION ] +# +# +# +# NoDebug +# ------- +# To speed code up, typically for product releases or such +# use this class instead if you globaly want to disable debugging class NoDebug: diff --git a/src/common/xmpp/features.py b/src/common/xmpp/features.py index c5504dcb1f38ccb93d1e066280bfa7545aa133de..c5d67dffa1e521e346146b5603068c1bbef9f38b 100644 --- a/src/common/xmpp/features.py +++ b/src/common/xmpp/features.py @@ -49,10 +49,10 @@ def _discover(disp,ns,jid,node=None,fb2b=0,fb2a=1): def discoverItems(disp,jid,node=None): """ Query remote object about any items that it contains. Return items list. """ - """ According to JEP-0030: - query MAY have node attribute - item: MUST HAVE jid attribute and MAY HAVE name, node, action attributes. - action attribute of item can be either of remove or update value.""" + # According to JEP-0030: + # query MAY have node attribute + # item: MUST HAVE jid attribute and MAY HAVE name, node, action attributes. + # action attribute of item can be either of remove or update value. ret=[] for i in _discover(disp,NS_DISCO_ITEMS,jid,node): if i.getName()=='agent' and i.getTag('name'): i.setAttr('name',i.getTagData('name')) @@ -61,10 +61,10 @@ def discoverItems(disp,jid,node=None): def discoverInfo(disp,jid,node=None): """ Query remote object about info that it publishes. Returns identities and features lists.""" - """ According to JEP-0030: - query MAY have node attribute - identity: MUST HAVE category and name attributes and MAY HAVE type attribute. - feature: MUST HAVE var attribute""" + # According to JEP-0030: + # query MAY have node attribute + # identity: MUST HAVE category and name attributes and MAY HAVE type attribute. + # feature: MUST HAVE var attribute""" identities , features = [] , [] for i in _discover(disp,NS_DISCO_INFO,jid,node): if i.getName()=='identity': identities.append(i.attrs) diff --git a/src/common/xmpp/features_nb.py b/src/common/xmpp/features_nb.py index a7a8b084935fcde396a3f5972bd32ac2fb925e22..5326dee7cc71356eb4a8945c62f07b038108cc41 100644 --- a/src/common/xmpp/features_nb.py +++ b/src/common/xmpp/features_nb.py @@ -58,10 +58,10 @@ def _discover(disp, ns, jid, node = None, fb2b=0, fb2a=1, cb=None): # this function is not used in gajim ??? def discoverItems(disp,jid,node=None, cb=None): """ Query remote object about any items that it contains. Return items list. """ - """ According to JEP-0030: - query MAY have node attribute - item: MUST HAVE jid attribute and MAY HAVE name, node, action attributes. - action attribute of item can be either of remove or update value.""" + # According to JEP-0030: + # query MAY have node attribute + # item: MUST HAVE jid attribute and MAY HAVE name, node, action attributes. + # action attribute of item can be either of remove or update value. def _on_response(result_array): ret=[] for result in result_array: @@ -75,10 +75,10 @@ def discoverItems(disp,jid,node=None, cb=None): # this one is def discoverInfo(disp,jid,node=None, cb=None): """ Query remote object about info that it publishes. Returns identities and features lists.""" - """ According to JEP-0030: - query MAY have node attribute - identity: MUST HAVE category and name attributes and MAY HAVE type attribute. - feature: MUST HAVE var attribute""" + # According to JEP-0030: + # query MAY have node attribute + # identity: MUST HAVE category and name attributes and MAY HAVE type attribute. + # feature: MUST HAVE var attribute def _on_response(result): identities , features = [] , [] for i in result: @@ -252,4 +252,4 @@ def delPrivacyList(disp,listname,cb=None): iq = Iq('set',NS_PRIVACY,payload=[Node('list',{'name':listname})]) _on_default_response(disp, iq, cb) -# vim: se ts=3: \ No newline at end of file +# vim: se ts=3: diff --git a/src/common/xmpp/filetransfer.py b/src/common/xmpp/filetransfer.py index bf04512421638e0fc01a85c9f0ba576c0a2ded1f..4ecae7ec8bedf889be33daab31497b9a700ed78d 100644 --- a/src/common/xmpp/filetransfer.py +++ b/src/common/xmpp/filetransfer.py @@ -58,16 +58,14 @@ class IBB(PlugIn): def StreamOpenHandler(self,conn,stanza): """ Handles opening of new incoming stream. Used internally. """ - """ -<iq type='set' - from='romeo@montague.net/orchard' - to='juliet@capulet.com/balcony' - id='inband_1'> - <open sid='mySID' - block-size='4096' - xmlns='http://jabber.org/protocol/ibb'/> -</iq> -""" + # <iq type='set' + # from='romeo@montague.net/orchard' + # to='juliet@capulet.com/balcony' + # id='inband_1'> + # <open sid='mySID' + # block-size='4096' + # xmlns='http://jabber.org/protocol/ibb'/> + # </iq> err=None sid,blocksize=stanza.getTagAttr('open','sid'),stanza.getTagAttr('open','block-size') self.DEBUG('StreamOpenHandler called sid->%s blocksize->%s'%(sid,blocksize),'info') @@ -110,29 +108,27 @@ class IBB(PlugIn): if stream['seq']==65536: stream['seq']=0 conn.send(Protocol('message',stream['direction'][1:],payload=[datanode,self._ampnode])) else: - """ notify the other side about stream closing - notify the local user about sucessfull send - delete the local stream""" + # notify the other side about stream closing + # notify the local user about sucessfull send + # delete the local stream conn.send(Protocol('iq',stream['direction'][1:],'set',payload=[Node(NS_IBB+' close',{'sid':sid})])) conn.Event(self.DBG_LINE,'SUCCESSFULL SEND',stream) del self._streams[sid] self._owner.UnregisterCycleHandler(self.SendHandler) - """ -<message from='romeo@montague.net/orchard' to='juliet@capulet.com/balcony' id='msg1'> - <data xmlns='http://jabber.org/protocol/ibb' sid='mySID' seq='0'> - qANQR1DBwU4DX7jmYZnncmUQB/9KuKBddzQH+tZ1ZywKK0yHKnq57kWq+RFtQdCJ - WpdWpR0uQsuJe7+vh3NWn59/gTc5MDlX8dS9p0ovStmNcyLhxVgmqS8ZKhsblVeu - IpQ0JgavABqibJolc3BKrVtVV1igKiX/N7Pi8RtY1K18toaMDhdEfhBRzO/XB0+P - AQhYlRjNacGcslkhXqNjK5Va4tuOAPy2n1Q8UUrHbUd0g+xJ9Bm0G0LZXyvCWyKH - kuNEHFQiLuCY6Iv0myq6iX6tjuHehZlFSh80b5BVV9tNLwNR5Eqz1klxMhoghJOA - </data> - <amp xmlns='http://jabber.org/protocol/amp'> - <rule condition='deliver-at' value='stored' action='error'/> - <rule condition='match-resource' value='exact' action='error'/> - </amp> -</message> -""" +# <message from='romeo@montague.net/orchard' to='juliet@capulet.com/balcony' id='msg1'> +# <data xmlns='http://jabber.org/protocol/ibb' sid='mySID' seq='0'> +# qANQR1DBwU4DX7jmYZnncmUQB/9KuKBddzQH+tZ1ZywKK0yHKnq57kWq+RFtQdCJ +# WpdWpR0uQsuJe7+vh3NWn59/gTc5MDlX8dS9p0ovStmNcyLhxVgmqS8ZKhsblVeu +# IpQ0JgavABqibJolc3BKrVtVV1igKiX/N7Pi8RtY1K18toaMDhdEfhBRzO/XB0+P +# AQhYlRjNacGcslkhXqNjK5Va4tuOAPy2n1Q8UUrHbUd0g+xJ9Bm0G0LZXyvCWyKH +# kuNEHFQiLuCY6Iv0myq6iX6tjuHehZlFSh80b5BVV9tNLwNR5Eqz1klxMhoghJOA +# </data> +# <amp xmlns='http://jabber.org/protocol/amp'> +# <rule condition='deliver-at' value='stored' action='error'/> +# <rule condition='match-resource' value='exact' action='error'/> +# </amp> +# </message> def ReceiveHandler(self,conn,stanza): """ Receive next portion of incoming datastream and store it write @@ -198,4 +194,4 @@ class IBB(PlugIn): conn.Event(self.DBG_LINE,'STREAM COMMITTED',stream) else: conn.send(Error(stanza,ERR_UNEXPECTED_REQUEST)) -# vim: se ts=3: \ No newline at end of file +# vim: se ts=3: diff --git a/src/common/xmpp/session.py b/src/common/xmpp/session.py index 010dccba95d9f52a39a5910ffb3beecb46050531..dc7b5f6773140ed38c666e64bf5a6395d9ed9d2f 100644 --- a/src/common/xmpp/session.py +++ b/src/common/xmpp/session.py @@ -13,7 +13,6 @@ ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. -__version__="$Id" """ When your handler is called it is getting the session instance as the first argument. @@ -23,6 +22,8 @@ one client for each connection. Is is specifically important when you are writing the server. """ +__version__="$Id" + from protocol import * # Transport-level flags diff --git a/src/common/xmpp/transports.py b/src/common/xmpp/transports.py index 738e12f8caebd863a5fd9528a8d642ef916b63f0..e588222afa82980c8157019527a2eb20a36b6989 100644 --- a/src/common/xmpp/transports.py +++ b/src/common/xmpp/transports.py @@ -266,7 +266,7 @@ class TLS(PlugIn): def _startSSL(self): """ Immidiatedly switch socket to TLS mode. Used internally.""" - """ Here we should switch pending_data to hint mode.""" + # Here we should switch pending_data to hint mode. tcpsock=self._owner.Connection tcpsock._sslObj = socket.ssl(tcpsock._sock, None, None) tcpsock._sslIssuer = tcpsock._sslObj.issuer() diff --git a/src/common/zeroconf/client_zeroconf.py b/src/common/zeroconf/client_zeroconf.py index 53200e7514f87d50bbe0741411bef6001a319a3b..47548dc739ca508b28b0b82e29e1ff0c49ed055e 100644 --- a/src/common/zeroconf/client_zeroconf.py +++ b/src/common/zeroconf/client_zeroconf.py @@ -87,7 +87,7 @@ class ZeroconfListener(IdleObject): def pollin(self): ''' accept a new incomming connection and notify queue''' sock = self.accept_conn() - ''' loop through roster to find who has connected to us''' + # loop through roster to find who has connected to us from_jid = None ipaddr = sock[1][0] for jid in self.conn_holder.getRoster().keys(): diff --git a/src/htmltextview.py b/src/htmltextview.py index adfba45411616a20fb954e3b92484db378d88801..7060396e00a5e96483d6266ca0e8d9a7193fe8ef 100644 --- a/src/htmltextview.py +++ b/src/htmltextview.py @@ -91,77 +91,76 @@ element_styles['tt'] = element_styles['kbd'] element_styles['i'] = element_styles['em'] element_styles['b'] = element_styles['strong'] -''' -========== - JEP-0071 -========== - -This Integration Set includes a subset of the modules defined for -XHTML 1.0 but does not redefine any existing modules, nor -does it define any new modules. Specifically, it includes the -following modules only: - -- Structure -- Text - - * Block - - phrasal - addr, blockquote, pre - Struc - div,p - Heading - h1, h2, h3, h4, h5, h6 - - * Inline - - phrasal - abbr, acronym, cite, code, dfn, em, kbd, q, samp, strong, var - structural - br, span - -- Hypertext (a) -- List (ul, ol, dl) -- Image (img) -- Style Attribute - -Therefore XHTML-IM uses the following content models: - - Block.mix - Block-like elements, e.g., paragraphs - Flow.mix - Any block or inline elements - Inline.mix - Character-level elements - InlineNoAnchor.class - Anchor element - InlinePre.mix - Pre element - -XHTML-IM also uses the following Attribute Groups: - -Core.extra.attrib - TBD -I18n.extra.attrib - TBD -Common.extra - style - - -... -#block level: -#Heading h -# ( pres = h1 | h2 | h3 | h4 | h5 | h6 ) -#Block ( phrasal = address | blockquote | pre ) -#NOT ( presentational = hr ) -# ( structural = div | p ) -#other: section -#Inline ( phrasal = abbr | acronym | cite | code | dfn | em | kbd | q | samp | strong | var ) -#NOT ( presentational = b | big | i | small | sub | sup | tt ) -# ( structural = br | span ) -#Param/Legacy param, font, basefont, center, s, strike, u, dir, menu, isindex +# ========== +# JEP-0071 +# ========== # -''' +# This Integration Set includes a subset of the modules defined for +# XHTML 1.0 but does not redefine any existing modules, nor +# does it define any new modules. Specifically, it includes the +# following modules only: +# +# - Structure +# - Text +# +# * Block +# +# phrasal +# addr, blockquote, pre +# Struc +# div,p +# Heading +# h1, h2, h3, h4, h5, h6 +# +# * Inline +# +# phrasal +# abbr, acronym, cite, code, dfn, em, kbd, q, samp, strong, var +# structural +# br, span +# +# - Hypertext (a) +# - List (ul, ol, dl) +# - Image (img) +# - Style Attribute +# +# Therefore XHTML-IM uses the following content models: +# +# Block.mix +# Block-like elements, e.g., paragraphs +# Flow.mix +# Any block or inline elements +# Inline.mix +# Character-level elements +# InlineNoAnchor.class +# Anchor element +# InlinePre.mix +# Pre element +# +# XHTML-IM also uses the following Attribute Groups: +# +# Core.extra.attrib +# TBD +# I18n.extra.attrib +# TBD +# Common.extra +# style +# +# +# ... +# block level: +# Heading h +# ( pres = h1 | h2 | h3 | h4 | h5 | h6 ) +# Block ( phrasal = address | blockquote | pre ) +# NOT ( presentational = hr ) +# ( structural = div | p ) +# other: section +# Inline ( phrasal = abbr | acronym | cite | code | dfn | em | +# kbd | q | samp | strong | var ) +# NOT ( presentational = b | big | i | small | sub | sup | tt ) +# ( structural = br | span ) +# Param/Legacy param, font, basefont, center, s, strike, u, dir, menu, +# isindex BLOCK_HEAD = set(( 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', )) BLOCK_PHRASAL = set(( 'address', 'blockquote', 'pre', )) diff --git a/src/notify.py b/src/notify.py index 9a6ba87e684e2fc1ea504dac238b8f7069e1fde8..05e3c3613065292bdd3b7dd8dc53d6234b8c03f2 100644 --- a/src/notify.py +++ b/src/notify.py @@ -455,7 +455,9 @@ class DesktopNotification: self.event_type = event_type self.title = title self.text = text - '''0.3.1 is the only version of notification daemon that has no way to determine which version it is. If no method exists, it means they're using that one.''' + # 0.3.1 is the only version of notification daemon that has no way + # to determine which version it is. If no method exists, it means + # they're using that one. self.default_version = [0, 3, 1] self.account = account self.jid = jid