|
|
|
@ -9,17 +9,18 @@ IGNORE_FIRST = 10 |
|
|
|
|
|
|
|
|
|
|
|
last_connect = 0 |
|
|
|
last_connect = 0 |
|
|
|
reconnect = False |
|
|
|
reconnect = False |
|
|
|
commands = dict() |
|
|
|
commands = {} |
|
|
|
commands_private = dict() |
|
|
|
commands_private = {} |
|
|
|
group_listeners = [] |
|
|
|
group_listeners = [] |
|
|
|
private_listeners = [] |
|
|
|
private_listeners = [] |
|
|
|
status_listeners = [] |
|
|
|
status_listeners = [] |
|
|
|
call_ats = dict() |
|
|
|
call_ats = {} |
|
|
|
call_ats_remove = [] |
|
|
|
call_ats_remove = [] |
|
|
|
|
|
|
|
call_ats_append = {} |
|
|
|
call_ats_id = 0 |
|
|
|
call_ats_id = 0 |
|
|
|
join_time = time.time()+60*60*24*365 #1 year in the future |
|
|
|
join_time = time.time()+60*60*24*365 #1 year in the future |
|
|
|
|
|
|
|
|
|
|
|
users = dict() |
|
|
|
users = {} |
|
|
|
|
|
|
|
|
|
|
|
STATUS_JOIN, STATUS_ONLINE, STATUS_OFFLINE, STATUS_RENAME, STATUS_XAWAY, STATUS_AWAY, STATUS_UNKNOWN = range(7) |
|
|
|
STATUS_JOIN, STATUS_ONLINE, STATUS_OFFLINE, STATUS_RENAME, STATUS_XAWAY, STATUS_AWAY, STATUS_UNKNOWN = range(7) |
|
|
|
SI, JINGLE = range(2) |
|
|
|
SI, JINGLE = range(2) |
|
|
|
@ -273,6 +274,7 @@ def loop(): |
|
|
|
"""Loop forever and handle the event-queue.""" |
|
|
|
"""Loop forever and handle the event-queue.""" |
|
|
|
global last_connect |
|
|
|
global last_connect |
|
|
|
global call_ats |
|
|
|
global call_ats |
|
|
|
|
|
|
|
global call_ats_append |
|
|
|
global reconnect |
|
|
|
global reconnect |
|
|
|
while True: |
|
|
|
while True: |
|
|
|
try: |
|
|
|
try: |
|
|
|
@ -295,6 +297,9 @@ def loop(): |
|
|
|
to_remove.append(cid) |
|
|
|
to_remove.append(cid) |
|
|
|
for cid in to_remove + call_ats_remove: |
|
|
|
for cid in to_remove + call_ats_remove: |
|
|
|
del call_ats[cid] |
|
|
|
del call_ats[cid] |
|
|
|
|
|
|
|
while len(call_ats_append)>0: |
|
|
|
|
|
|
|
cid,call = call_ats_append.popitem() |
|
|
|
|
|
|
|
call_ats[cid] = call |
|
|
|
|
|
|
|
|
|
|
|
except xmpp.protocol.Conflict: |
|
|
|
except xmpp.protocol.Conflict: |
|
|
|
print "detected another connection, quitting..." |
|
|
|
print "detected another connection, quitting..." |
|
|
|
@ -325,9 +330,9 @@ def callAt(func,_time,*args): |
|
|
|
|
|
|
|
|
|
|
|
@param func -- Function to be called |
|
|
|
@param func -- Function to be called |
|
|
|
@param time -- The time when the message will be called""" |
|
|
|
@param time -- The time when the message will be called""" |
|
|
|
global call_ats |
|
|
|
global call_ats_append |
|
|
|
global call_ats_id |
|
|
|
global call_ats_id |
|
|
|
call_ats[call_ats_id]=[func,_time,args] |
|
|
|
call_ats_append[call_ats_id]=[func,_time,args] |
|
|
|
call_ats_id+=1 |
|
|
|
call_ats_id+=1 |
|
|
|
return call_ats_id-1 |
|
|
|
return call_ats_id-1 |
|
|
|
|
|
|
|
|
|
|
|
|