About use gmail and gtalk at same time.

3 views
Skip to first unread message

wq1...@gmail.com

unread,
Mar 18, 2006, 6:48:43 AM3/18/06
to confbot
Hi all:
First of all,sorry for my pool english.

I have found one problem of confbot version 1.32, actually, it's a
problem of jabber.py.

Suppose you are a member of one confbot group and are talking with
your friends with gtalk. and suppose you have open gmail's new feather
to store talk history in gmail. now suppose your friend send one email
to you and you open gmail to read the mail. then, after read the mail
and exit the gmail, you will find that you can not recv others's
message in gtalk through confbot.

This is because when you open gmail, another Uid of your jabber Id
was informed to the confbot. and when you exit gmail, confbot will
treat your jabber Id as 'unavalibly', even your gtalk is still open.
there is a online check in the function of sendtoall in confbot.py will
return fail. so confbot do not send any message to you any more.

I have modify the jabber.py to resolve this problem. It is very
simple and just two function change.
one is: in the function
class Roster::_set: after change, the last line of this function
is just like:
self._data[jid] = { 'name': name, 'ask': ask, 'sub': sub,
'online': online, 'status': None,
'show': None,
'nodes':[]}

second is in the function
class Roster::def _setOnline(self,jid,val): after change, the
whole function become:

def _setOnline(self,jid,val):
"""Used internally - private"""
jid = unicode(jid)
if self._data.has_key(jid):
self._data[jid]['online'] = val
else: ## fall back
jid_basic = JID(jid).getStripped()
if self._data.has_key(jid_basic):
if val == 'online':
self._data[jid_basic]['online'] = val
if not jid in self._data[jid_basic]['nodes']:
self._data[jid_basic]['nodes'].append(jid)
elif val == 'offline':
if jid in self._data[jid_basic]['nodes']:
self._data[jid_basic]['nodes'].remove(jid)
if len(self._data[jid_basic]['nodes']) == 0:
self._data[jid_basic]['online'] = val
else:
self._data[jid_basic]['online'] = val

What I do is just store each Uid of jid when it is online.and when
recv unvalible message, just remove the Uid of Jid. if Jid have no any
Uid. Exit the Jid.

maybe have problem.
take it as your wish.

Reply all
Reply to author
Forward
0 new messages