Skip to content
Snippets Groups Projects
Commit 98256475 authored by Yann Leboulanger's avatar Yann Leboulanger
Browse files

small changes

parent d9f5bd08
No related branches found
No related tags found
No related merge requests found
......@@ -66,6 +66,8 @@ def presenceCB(self, con, prs):
log.debug("subscribe request from %s" % who)
if self.cfgParser.Core_alwaysauth == 1 or string.find(who, "@") <= 0:
self.con.send(common.jabber.Presence(who, 'subscribed'))
if string.find(who, "@") <= 0:
self.hub.sendPlugin('NOTIFY', (who, 'offline', 'offline'))
else:
self.hub.sendPlugin('SUBSCRIBE', who)
elif type == 'subscribed':
......@@ -205,20 +207,21 @@ def mainLoop(self):
def loadPlugins(gc):
modStr = gc.cfgParser.Core_modules
mods = string.split (modStr, ' ')
if modStr :
mods = string.split (modStr, ' ')
for mod in mods:
modObj = gc.hub.newPlugin(mod)
gc.hub.register(mod, 'ROSTER')
gc.hub.register(mod, 'NOTIFY')
gc.hub.register(mod, 'MSG')
gc.hub.register(mod, 'SUBSCRIBED')
gc.hub.register(mod, 'SUBSCRIBE')
gc.hub.register(mod, 'AGENTS')
gc.hub.register(mod, 'AGENT_INFO')
gc.hub.register(mod, 'QUIT')
gc.hub.register(mod, 'ACC_OK')
modObj.load()
for mod in mods:
modObj = gc.hub.newPlugin(mod)
gc.hub.register(mod, 'ROSTER')
gc.hub.register(mod, 'NOTIFY')
gc.hub.register(mod, 'MSG')
gc.hub.register(mod, 'SUBSCRIBED')
gc.hub.register(mod, 'SUBSCRIBE')
gc.hub.register(mod, 'AGENTS')
gc.hub.register(mod, 'AGENT_INFO')
gc.hub.register(mod, 'QUIT')
gc.hub.register(mod, 'ACC_OK')
modObj.load()
# END loadPLugins
def start():
......
......@@ -798,7 +798,7 @@ def read_queue(self):
user1 = user(jid, jid, ['Agents'], ev[1][1], ev[1][2], 'from')
iterU = self.r.treestore.append(self.r.l_group['Agents'], \
(self.r.pixbufs[ev[1][1]], jid, 'agent', FALSE, \
self.userbgcolor, TRUE))
self.r.userbgcolor, TRUE))
self.r.l_contact[jid] = {'user':user1, 'iter':[iterU]}
else:
#Update existing line
......@@ -857,7 +857,10 @@ def read_queue(self):
if Wbrowser:
Wbrowser.agents(ev[1])
elif ev[0] == 'AGENT_INFO':
Wreg = agent_reg(ev[1][0], ev[1][1], self.r)
if not ev[1][1].has_key('instructions'):
warning('error contacting %s' % ev[1][0])
else:
Wreg = agent_reg(ev[1][0], ev[1][1], self.r)
#('ACC_OK', (hostname, login, pasword, name, ressource))
elif ev[0] == 'ACC_OK':
print "acc_ok"
......
......@@ -49,6 +49,7 @@ def read_queue(self):
return
elif ev[0] == 'NOTIFY':
status = ev[1][2]
jid = string.split(ev[1][0], '/')[0]
if not status:
status = ""
if lognotsep == 1:
......@@ -57,16 +58,18 @@ def read_queue(self):
ev[1][1], status))
fic.close()
if lognotusr == 1:
fic = open(LOGPATH + ev[1][0], "a")
fic.write("%s:%s:%s:%s\n" % (tim, ev[1][0], \
fic = open(LOGPATH + jid, "a")
fic.write("%s:%s:%s:%s\n" % (tim, jid, \
ev[1][1], status))
fic.close()
elif ev[0] == 'MSG':
fic = open(LOGPATH + ev[1][0], "a")
jid = string.split(ev[1][0], '/')[0]
fic = open(LOGPATH + jid, "a")
fic.write("%s:recv:%s\n" % (tim, ev[1][1]))
fic.close()
elif ev[0] == 'MSGSENT':
fic = open(LOGPATH + ev[1][0], "a")
jid = string.split(ev[1][0], '/')[0]
fic = open(LOGPATH + jid, "a")
fic.write("%s:sent:%s\n" % (tim, ev[1][1]))
fic.close()
time.sleep(0.5)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment