[thorstenp] convert some strings to comment

This commit is contained in:
Yann Leboulanger 2008-12-02 14:09:18 +00:00
parent 630c15e2d0
commit 983301d589
10 changed files with 153 additions and 161 deletions

View File

@ -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'''

View File

@ -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:

View File

@ -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)

View File

@ -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:
# vim: se ts=3:

View File

@ -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:
# vim: se ts=3:

View File

@ -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

View File

@ -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()

View File

@ -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():

View File

@ -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', ))

View File

@ -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