small changes

This commit is contained in:
Yann Leboulanger 2003-12-20 13:22:37 +00:00
parent d9f5bd08e8
commit 9825647585
3 changed files with 28 additions and 19 deletions

View file

@ -66,6 +66,8 @@ class GajimCore:
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 @@ class GajimCore:
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():

View file

@ -798,7 +798,7 @@ class plugin:
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 @@ class plugin:
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"

View file

@ -49,6 +49,7 @@ class plugin:
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 @@ class plugin:
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)