version = "0.2" name = "h323bl" __module_name__ = name __module_version__ = version __module_description__ = "BuddyList per gatekeeper h323" __module_author__ = "Hrd " import xchat import httplib import string import time URL = 'h323.debord.ortiche.net' GET = '/registrati.php?online=' PATH = 'gente.dat' INTERVAL = 120000 xchat.prnt('%s - v%s caricato' %(name,version)) def blonline(userdata): global pazzi global quary global connstat global lastcheck connstat = 1 try: busqueda = run(quary) loro = busqueda.split(':') puzzi = loro[1].split(',') connstat = 1 now = time.localtime(time.time()) ora = time.strftime("%Y-%m-%d %H:%M:%S %Z", now) i = 0 for x in puzzi: if x <> pazzi[i]: if x == "1": xchat.prnt("::: telefono: %s e' \0034online\003 (%s) :::" % (pizzi[i],ora)) if x == "0": xchat.prnt("::: telefono: %s e' offline (%s) :::" % (pizzi[i],ora)) i += 1 lastcheck = now pazzi = puzzi except: if connstat: xchat.prnt("::: telefono: impossibile connettersi (%s) :::" % (ora)) connstat = 0 return 1 def run(query): conn = httplib.HTTPConnection(URL) conn.request ("GET", GET + query) r = conn.getresponse() data = r.read() dota = data.strip() return dota def amici(word, word_eol, userdata): global pizzi global pazzi global lastcheck try: ora = time.strftime("%H:%M", lastcheck) except: ora = "N/A" i = 0 xchat.prnt('---------\t----------------') xchat.prnt(' nome \t stato [%s] ' % (ora)) xchat.prnt('---------\t----------------') for wo in pizzi: if pazzi[i] == "0": xchat.prnt('%s \t offline' % (wo)) if pazzi[i] == "1": xchat.prnt('%s \t \0034online\003' % (wo)) if pazzi[i] == "2": xchat.prnt('%s \t \0032occupato\003' % (wo)) i += 1 xchat.prnt('---------\t----------------') return xchat.EAT_ALL try: bula = open(PATH,"r") bala = bula.read() bula.close() xchat.hook_timer(INTERVAL, blonline) quary = bala.strip() pizzi = quary.split(',') pazzi = ['0']*len(pizzi) xchat.prnt('telefono: caricati gli amici %s !' % (pizzi)) xchat.hook_command("TELEFONO", amici, help="/TELEFONO Ti dice chi c'e' e chi non c'e'") except IOError: xchat.prnt('telefono: file con gli amici non trovato ! crea un file gente.dat dentro la directory di xchat ( ad es ~.xchat2/ ) e scrivici i nomi o gli alias dei tuoi amici, separati da virgole.')