Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/alkorgun/blacksmith-2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAl Korgun <alkorgun@gmail.com>2012-11-26 22:20:52 +0400
committerAl Korgun <alkorgun@gmail.com>2012-11-26 22:20:52 +0400
commit07306bf3c49891896c5f88eef94244a5d57023a0 (patch)
treea3ce46f8fe9ab496c2a881a73aae30a69ef7b553
parent46ba2c68d796fb338aae36f563c6df1ec9467592 (diff)
commands "vcard" and "servstat" added
-rw-r--r--BlackSmith.py78
-rw-r--r--LICENSE2
-rw-r--r--NOTICE2
-rw-r--r--README16
-rw-r--r--expansions/access/access.name6
-rw-r--r--expansions/access/acclist.name6
-rw-r--r--expansions/access/acclist2.name6
-rw-r--r--expansions/access/gaccess.name6
-rw-r--r--expansions/access/laccess.name6
-rw-r--r--expansions/alive_keeper/code.py4
-rw-r--r--expansions/allweb/bash.name6
-rw-r--r--expansions/allweb/chuck.name6
-rw-r--r--expansions/allweb/currency.name6
-rw-r--r--expansions/allweb/download.name6
-rw-r--r--expansions/allweb/gismeteo.name6
-rw-r--r--expansions/allweb/google.name6
-rw-r--r--expansions/allweb/imdb.name6
-rw-r--r--expansions/allweb/ithappens.name6
-rw-r--r--expansions/allweb/jc.name6
-rw-r--r--expansions/allweb/jquote.name6
-rw-r--r--expansions/allweb/kino.name6
-rw-r--r--expansions/allweb/market.name6
-rw-r--r--expansions/allweb/python.name6
-rw-r--r--expansions/allweb/shorten.name6
-rw-r--r--expansions/allweb/tr.name6
-rw-r--r--expansions/apocalypse/apocalypse.name6
-rw-r--r--expansions/basic_control/code.py12
-rw-r--r--expansions/basic_control/exit.name6
-rw-r--r--expansions/basic_control/join.name6
-rw-r--r--expansions/basic_control/leave.name6
-rw-r--r--expansions/basic_control/reconnect.name6
-rw-r--r--expansions/basic_control/rejoin.name6
-rw-r--r--expansions/basic_control/reload.name6
-rw-r--r--expansions/books/books.name6
-rw-r--r--expansions/books/code.py6
-rw-r--r--expansions/books/library.name6
-rw-r--r--expansions/bot_sends/clear.name6
-rw-r--r--expansions/bot_sends/code.py2
-rw-r--r--expansions/bot_sends/invite.name6
-rw-r--r--expansions/bot_sends/more.name6
-rw-r--r--expansions/bot_sends/say.name6
-rw-r--r--expansions/bot_sends/send.name6
-rw-r--r--expansions/bot_sends/sendall.name6
-rw-r--r--expansions/bot_sends/test.name6
-rw-r--r--expansions/bot_sends/toadmin.name6
-rw-r--r--expansions/calendar/calendar.name6
-rw-r--r--expansions/cmd_control/taboo.name6
-rw-r--r--expansions/config/client.name6
-rw-r--r--expansions/config/code.py4
-rw-r--r--expansions/config/config.name6
-rw-r--r--expansions/converter/convert.name6
-rw-r--r--expansions/cron/code.py2
-rw-r--r--expansions/cron/cron.name6
-rw-r--r--expansions/exp_control/expinfo.name6
-rw-r--r--expansions/exp_control/expload.name6
-rw-r--r--expansions/exp_control/expunload.name6
-rw-r--r--expansions/exp_control/insc.py2
-rw-r--r--expansions/exp_control/tumbler.name6
-rw-r--r--expansions/extra_control/code.py2
-rw-r--r--expansions/extra_control/private.name6
-rw-r--r--expansions/extra_control/remote.name6
-rw-r--r--expansions/extra_control/turbo.name6
-rw-r--r--expansions/game/code.py2
-rw-r--r--expansions/game/game.name6
-rw-r--r--expansions/get_iq/code.py223
-rw-r--r--expansions/get_iq/idle.name6
-rw-r--r--expansions/get_iq/insc.py6
-rw-r--r--expansions/get_iq/list.name6
-rw-r--r--expansions/get_iq/ping.name6
-rw-r--r--expansions/get_iq/pingstat.en8
-rw-r--r--expansions/get_iq/pingstat.ru8
-rw-r--r--expansions/get_iq/pstat.name6
-rw-r--r--expansions/get_iq/servstat.en6
-rw-r--r--expansions/get_iq/servstat.name4
-rw-r--r--expansions/get_iq/servstat.ru6
-rw-r--r--expansions/get_iq/uptime.name6
-rw-r--r--expansions/get_iq/vcard.en8
-rw-r--r--expansions/get_iq/vcard.name4
-rw-r--r--expansions/get_iq/vcard.ru8
-rw-r--r--expansions/get_iq/version.en2
-rw-r--r--expansions/get_iq/version.name6
-rw-r--r--expansions/get_iq/version.ru2
-rw-r--r--expansions/help/comacc.name6
-rw-r--r--expansions/help/commands.name6
-rw-r--r--expansions/help/help.name6
-rw-r--r--expansions/help/location.name6
-rw-r--r--expansions/info/chatslist.name6
-rw-r--r--expansions/info/inmuc.name6
-rw-r--r--expansions/info/online.name6
-rw-r--r--expansions/info/search.name6
-rw-r--r--expansions/info/visitors.name6
-rw-r--r--expansions/interpreter/calc.name6
-rw-r--r--expansions/interpreter/eval.name6
-rw-r--r--expansions/interpreter/exec.name6
-rw-r--r--expansions/interpreter/sh.name6
-rw-r--r--expansions/muc/admin.name6
-rw-r--r--expansions/muc/ban.name6
-rw-r--r--expansions/muc/code.py2
-rw-r--r--expansions/muc/fullban.name6
-rw-r--r--expansions/muc/fullunban.name6
-rw-r--r--expansions/muc/kick.name6
-rw-r--r--expansions/muc/member.name6
-rw-r--r--expansions/muc/moder.name6
-rw-r--r--expansions/muc/none.name6
-rw-r--r--expansions/muc/owner.name6
-rw-r--r--expansions/muc/participant.name6
-rw-r--r--expansions/muc/subject.name6
-rw-r--r--expansions/muc/visitor.name6
-rw-r--r--expansions/new_year/new_year.name6
-rw-r--r--expansions/note/note.name6
-rw-r--r--expansions/roster_control/roster.name6
-rw-r--r--expansions/roster_control/roster2.name6
-rw-r--r--expansions/sconf_attrs/botjid.name6
-rw-r--r--expansions/sconf_attrs/botnick.name6
-rw-r--r--expansions/sconf_attrs/botstatus.name6
-rw-r--r--expansions/sconf_attrs/code.py2
-rw-r--r--expansions/sconf_attrs/password.name6
-rw-r--r--expansions/sconf_attrs/prefix.name6
-rw-r--r--expansions/session_stats/botup.en (renamed from expansions/session_stat/botup.en)0
-rw-r--r--expansions/session_stats/botup.name (renamed from expansions/session_stat/botup.name)6
-rw-r--r--expansions/session_stats/botup.ru (renamed from expansions/session_stat/botup.ru)0
-rw-r--r--expansions/session_stats/code.py (renamed from expansions/session_stat/code.py)36
-rw-r--r--expansions/session_stats/comstat.en (renamed from expansions/session_stat/comstat.en)0
-rw-r--r--expansions/session_stats/comstat.name (renamed from expansions/session_stat/comstat.name)6
-rw-r--r--expansions/session_stats/comstat.ru (renamed from expansions/session_stat/comstat.ru)0
-rw-r--r--expansions/session_stats/excinfo.en (renamed from expansions/session_stat/excinfo.en)0
-rw-r--r--expansions/session_stats/excinfo.name (renamed from expansions/session_stat/excinfo.name)6
-rw-r--r--expansions/session_stats/excinfo.ru (renamed from expansions/session_stat/excinfo.ru)0
-rw-r--r--expansions/session_stats/insc.py (renamed from expansions/session_stat/insc.py)4
-rw-r--r--expansions/session_stats/stat.en (renamed from expansions/session_stat/stat.en)0
-rw-r--r--expansions/session_stats/stat.name (renamed from expansions/session_stat/stat.name)6
-rw-r--r--expansions/session_stats/stat.ru (renamed from expansions/session_stat/stat.ru)0
-rw-r--r--expansions/sheriff/code.py4
-rw-r--r--expansions/sheriff/order.name6
-rw-r--r--expansions/talkers/code.py12
-rw-r--r--expansions/talkers/talkers.name6
-rw-r--r--expansions/turn/turn.name6
-rw-r--r--expansions/user_stats/code.py36
-rw-r--r--expansions/user_stats/here.name6
-rw-r--r--expansions/user_stats/userstat.name6
-rw-r--r--expansions/wtf/code.py31
-rw-r--r--expansions/wtf/def.name6
-rw-r--r--expansions/wtf/insc.py2
-rw-r--r--expansions/wtf/wtf.name6
144 files changed, 642 insertions, 518 deletions
diff --git a/BlackSmith.py b/BlackSmith.py
index c94a726..23432b1 100644
--- a/BlackSmith.py
+++ b/BlackSmith.py
@@ -179,7 +179,7 @@ def exc_info_(fp = None):
except:
pass
-database = (itypes.Database)
+sleep, database = time.sleep, itypes.Database
def get_exc():
try:
@@ -215,7 +215,7 @@ def Print(text, color = False):
def try_sleep(slp):
try:
- time.sleep(slp)
+ sleep(slp)
except KeyboardInterrupt:
os._exit(0)
except:
@@ -264,7 +264,7 @@ GenConFile = static % ("config.ini")
ConDispFile = static % ("clients.ini")
ChatsFile = dynamic % ("chats.db")
-(BsMark, BsVer, BsRev) = (2, 35, 0)
+(BsMark, BsVer, BsRev) = (2, 36, 0)
if os.access(SvnCache, os.R_OK):
Cache = open(SvnCache).readlines()
@@ -446,7 +446,10 @@ class expansion(object):
command_handler(self, *ls)
for inst, ls in self.handlers:
self.handler_register(getattr(self, inst.func_name), ls)
- self.AnsBase = AnsBase_temp
+ try:
+ self.AnsBase = AnsBase_temp
+ except NameError:
+ pass
def dels(self, full = False):
while self.cmds:
@@ -853,7 +856,7 @@ def Message(instance, body, disp = None):
Info["omsg"].plus()
Sender(disp, xmpp.Message(instance, text, ltype))
body = body[PrivLimit:].strip()
- time.sleep(2)
+ sleep(2)
body = "[%d/%s] %s" % (col.plus(), all, body)
Info["omsg"].plus()
Sender(disp, xmpp.Message(instance, body.strip(), ltype))
@@ -1053,7 +1056,7 @@ def collectExc(instance, command = None):
def load_expansions():
Print("\n\nExpansions loading...\n", color4)
- for ExpDir in os.listdir(ExpsDir):
+ for ExpDir in sorted(os.listdir(ExpsDir)):
if (".svn") == (ExpDir) or not os.path.isdir(os.path.join(ExpsDir, ExpDir)):
continue
expansions[ExpDir] = exp = expansion(ExpDir)
@@ -1223,21 +1226,23 @@ def calculate(Numb = int()):
return (int() if not isNumber(Numb) else int(Numb))
def check_copies():
- try:
- if not os.path.isfile(PidFile):
- raise SelfExc()
+ Cache = Base = {"PID": BsPid, "up": Info["sess"], "alls": []}
+ if os.path.isfile(PidFile):
try:
Cache = eval(get_file(PidFile))
except:
- del_file(PidFile); raise SelfExc()
- if BsPid == Cache["PID"]:
- Cache["alls"].append(strTime())
- elif oSlist[0]:
- get_pipe(sys_cmds[4] % (Cache["PID"])); raise SelfExc()
+ del_file(PidFile)
+ Cache = Base
else:
- os.kill(Cache["PID"], 9); raise SelfExc()
- except:
- Cache = {"PID": BsPid, "up": Info["sess"], "alls": []}
+ try:
+ if BsPid == Cache["PID"]:
+ Cache["alls"].append(strTime())
+ elif oSlist[0]:
+ get_pipe(sys_cmds[4] % (Cache["PID"])); raise SelfExc()
+ else:
+ os.kill(Cache["PID"], 9); raise SelfExc()
+ except:
+ Cache = Base
exec_(cat_file, (PidFile, str(Cache)))
del Cache["PID"]; Info.update(Cache)
@@ -1326,7 +1331,7 @@ def Xmpp_Presence_Cb(disp, stanza):
if Chats[conf].nick == nick and aDesc.get(Role[0], 0) >= 2:
Chats[conf].isModer = True
Chats[conf].leave(AnsBase[25])
- time.sleep(.4)
+ sleep(0.4)
Chats[conf].join()
xmpp_raise()
else:
@@ -1378,7 +1383,7 @@ def Xmpp_Iq_Cb(disp, stanza):
Name = (stanza.getTag(Types[16]) or stanza.getTag(Types[17]))
if Name:
Name = Name.getNamespace()
- if Features.count(Name):
+ if Name in Features:
answer = stanza.buildReply(Types[8])
if Name == Features[5]:
query = answer.getTag(Types[18])
@@ -1399,20 +1404,18 @@ def Xmpp_Iq_Cb(disp, stanza):
if oSlist[0]:
os_name = get_pipe(sys_cmds[5]).strip()
elif oSlist[1]:
- os_name = os.uname()[0]
+ os_name = "{0} {2:.16} [{4}]".format(*os.uname())
else:
os_name = "Os[%s]" % (BotOs)
query.setTagData("os", "%s / PyVer[%s]" % (os_name, PyVer))
elif Name == Features[2]:
query = answer.getTag(Types[18])
- utc = strTime("%Y%m%dT%H:%M:%S", False)
+ query.setTagData("utc", strTime("%Y%m%dT%H:%M:%S", False))
tz = strTime("%Z")
if oSlist[0]:
tz = tz.decode("cp1251")
- dis = strTime("%a, %d %b %Y %H:%M:%S UTC")
- query.setTagData("utc", utc)
query.setTagData("tz", tz)
- query.setTagData("display", dis)
+ query.setTagData("display", time.asctime())
elif Name == Features[3]:
query = answer.addChild(Types[17], {}, [], Features[3])
query.setTagData("utc", strTime("%Y-%m-%dT%H:%M:%SZ", False))
@@ -1460,7 +1463,7 @@ def Xmpp_Message_Cb(disp, stanza):
if not isConf:
xmpp_raise()
Chats[instance].join()
- time.sleep(0.6)
+ sleep(0.6)
Message(source, body)
xmpp_raise()
if Subject:
@@ -1494,7 +1497,7 @@ def Xmpp_Message_Cb(disp, stanza):
if Cmds.has_key(command):
VarCache["idle"] = time.time()
VarCache["action"] = AnsBase[27] % command.upper()
- Cmds[command].execute(stype, (source, instance, nick), (Copy.pop() if Copy else ""), disp)
+ Cmds[command].execute(stype, (source, instance, nick), (Copy[0] if Copy else ""), disp)
else:
call_efunctions("01eh", (stanza, isConf, stype, (source, instance, nick), body, isToBs, disp,))
@@ -1505,9 +1508,16 @@ def connect_client(source, InstanceAttrs):
disp = xmpp.Client(host, cport, None)
Print("\n\n'%s' connecting..." % (source), color4)
if ConTls:
- ConType = disp.connect((server, cport), None, None, False)
+ ConType = (None, False)
else:
- ConType = disp.connect((server, cport), None, False, True)
+ ConType = (False, True)
+ try:
+ ConType = disp.connect((server, cport), None, *ConType)
+ except KeyboardInterrupt:
+ raise KeyboardInterrupt("Interrupt (Ctrl+C)")
+ except:
+ Print("\n'%s' can't connect to '%s' (Port: %s). I'll retry later..." % (source, server.upper(), str(cport)), color2)
+ return (False, False)
if ConType:
ConType = ConType.upper()
if ConTls and ConType != "TLS":
@@ -1556,7 +1566,7 @@ def connect_client(source, InstanceAttrs):
def connectAndDispatch(disp):
if Reverse_disp(disp, False):
- time.sleep(60)
+ sleep(60)
for conf in Chats.keys():
if disp == Chats[conf].disp:
Chats[conf].join()
@@ -1582,7 +1592,7 @@ def Reverse_disp(disp, chats_ = True):
Chats[conf].join()
return True
else:
- time.sleep(60)
+ sleep(60)
def Dispatch_handler(disp):
ZeroCycles = itypes.Number()
@@ -1625,8 +1635,8 @@ def load_mark2():
load_expansions()
call_sfunctions("00si")
connect_clients()
- while len(Clients.keys()) is 0:
- pass
+ while len(Clients.keys()) == 0:
+ sleep(0.02)
Print("\n\nYahoo! I am online!", color3)
join_chats()
Print("\n\n%s is ready to serve!\n\n" % (ProdName), color3)
@@ -1636,12 +1646,12 @@ def load_mark2():
if ThrName not in iThr.ThrNames():
composeThr(Dispatch_handler, ThrName, (disp,)).start()
while VarCache["alive"]:
- time.sleep(180)
+ sleep(180)
Cls = itypes.Number()
for Name in iThr.ThrNames():
if Name.startswith(Types[13]):
Cls.plus()
- if 0 is Cls._int():
+ if Cls._int() == 0:
sys_exit("All of the clients now fallen!")
sys.exc_clear()
gc.collect()
diff --git a/LICENSE b/LICENSE
index 9dbeff1..0d85836 100644
--- a/LICENSE
+++ b/LICENSE
@@ -187,7 +187,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
- Copyright (2011-2012) Al Korgun [alkorgun@gmail.com]
+ Copyright (2010-2012) Al Korgun [alkorgun@gmail.com]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/NOTICE b/NOTICE
index 8033f3b..524bf4d 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,5 +1,5 @@
BlackSmith mark.2 xmpp bot
- Copyright (2011-2012) Al Korgun [alkorgun@gmail.com]
+ Copyright (2010-2012) Al Korgun [alkorgun@gmail.com]
This product based on Python Programming Language (http://python.org/).
diff --git a/README b/README
index a497bb7..05319d5 100644
--- a/README
+++ b/README
@@ -1,24 +1,24 @@
-This is BlackSmith mark.2 xmpp bot (Second generation of BlackSmith)
+This is BlackSmith mark.2 xmpp bot (the second generation of BlackSmith)
To use Black-2 you will need:
1. OS: *nix or Microsoft Windows (FreeBSD amd64 recommended)
2. Python 2.6 or higher (Python 3+ isn't required)
3. Python's sqlite lib. (Py-Sqlite3)
-4. Subversion (or Tortoise SVN client for Windows)
+4. Subversion (or TortoiseSVN for Windows)
Installation:
-1) Type in console (*nix):
+1) Type to the console (*nix):
svn checkout http://blacksmith-2.googlecode.com/svn/trunk/ Black-2
-2) Rename config_.ini to config.ini (static/) and fill it
+2) Rename config_.ini to config.ini (./static/) and fill it
-3) Same actions with static/clients_.ini (optional)
+3) The same actions with ./static/clients_.ini (optional)
-That is all! You can run BlackSmith.py
+That is all! You can run -> BlackSmith.py
-Offial GoogleCode page: http://code.google.com/p/blacksmith-2/
+Official GoogleCode page: http://code.google.com/p/blacksmith-2/
-Offial Jabber Conference: Witcher@conference.jabber.ru \ No newline at end of file
+Official Jabber Conference: Witcher@conference.jabber.ru
diff --git a/expansions/access/access.name b/expansions/access/access.name
index 2977625..96bdb38 100644
--- a/expansions/access/access.name
+++ b/expansions/access/access.name
@@ -1,4 +1,4 @@
-{
- "RU": "доступ",
- "UA": "доступ"
+{
+ "RU": "доступ",
+ "UA": "доступ"
} \ No newline at end of file
diff --git a/expansions/access/acclist.name b/expansions/access/acclist.name
index c49f680..912c3a3 100644
--- a/expansions/access/acclist.name
+++ b/expansions/access/acclist.name
@@ -1,4 +1,4 @@
-{
- "RU": "доступы",
- "UA": "доступы"
+{
+ "RU": "доступы",
+ "UA": "доступы"
} \ No newline at end of file
diff --git a/expansions/access/acclist2.name b/expansions/access/acclist2.name
index a178f60..ad7de3e 100644
--- a/expansions/access/acclist2.name
+++ b/expansions/access/acclist2.name
@@ -1,4 +1,4 @@
-{
- "RU": "доступы*",
- "UA": "доступы*"
+{
+ "RU": "доступы*",
+ "UA": "доступы*"
} \ No newline at end of file
diff --git a/expansions/access/gaccess.name b/expansions/access/gaccess.name
index db911bd..59c9422 100644
--- a/expansions/access/gaccess.name
+++ b/expansions/access/gaccess.name
@@ -1,4 +1,4 @@
-{
- "RU": "гдоступ",
- "UA": "гдоступ"
+{
+ "RU": "гдоступ",
+ "UA": "гдоступ"
} \ No newline at end of file
diff --git a/expansions/access/laccess.name b/expansions/access/laccess.name
index b48bcdd..9c62820 100644
--- a/expansions/access/laccess.name
+++ b/expansions/access/laccess.name
@@ -1,4 +1,4 @@
-{
- "RU": "локдоступ",
- "UA": "локдоступ"
+{
+ "RU": "локдоступ",
+ "UA": "локдоступ"
} \ No newline at end of file
diff --git a/expansions/alive_keeper/code.py b/expansions/alive_keeper/code.py
index e020a7c..e39ad8c 100644
--- a/expansions/alive_keeper/code.py
+++ b/expansions/alive_keeper/code.py
@@ -19,7 +19,7 @@ class expansion_temp(expansion):
Clients[get_disp(disp)].aKeeper = itypes.Number()
while VarCache["alive"]:
- time.sleep(360)
+ sleep(360)
ThrIds = iThr.ThrNames()
for disp in Clients.keys():
if not hasattr(Clients[disp], "aKeeper"):
@@ -57,7 +57,7 @@ class expansion_temp(expansion):
Chats[conf].aKeeper = itypes.Number()
while VarCache["alive"]:
- time.sleep(360)
+ sleep(360)
ThrIds = iThr.ThrNames()
for conf in Chats.keys():
if not (online(Chats[conf].disp) and Chats[conf].IamHere):
diff --git a/expansions/allweb/bash.name b/expansions/allweb/bash.name
index e3a39d9..63a6b41 100644
--- a/expansions/allweb/bash.name
+++ b/expansions/allweb/bash.name
@@ -1,4 +1,4 @@
-{
- "RU": "баш",
- "UA": "баш"
+{
+ "RU": "баш",
+ "UA": "баш"
} \ No newline at end of file
diff --git a/expansions/allweb/chuck.name b/expansions/allweb/chuck.name
index 7116f5b..79bb773 100644
--- a/expansions/allweb/chuck.name
+++ b/expansions/allweb/chuck.name
@@ -1,4 +1,4 @@
-{
- "RU": "чак",
- "UA": "чак"
+{
+ "RU": "чак",
+ "UA": "чак"
} \ No newline at end of file
diff --git a/expansions/allweb/currency.name b/expansions/allweb/currency.name
index 1edb727..703ebff 100644
--- a/expansions/allweb/currency.name
+++ b/expansions/allweb/currency.name
@@ -1,4 +1,4 @@
-{
- "RU": "валюты",
- "UA": "валюты"
+{
+ "RU": "валюты",
+ "UA": "валюты"
} \ No newline at end of file
diff --git a/expansions/allweb/download.name b/expansions/allweb/download.name
index b8512bf..ed76841 100644
--- a/expansions/allweb/download.name
+++ b/expansions/allweb/download.name
@@ -1,4 +1,4 @@
-{
- "RU": "скачать",
- "UA": "скачать"
+{
+ "RU": "скачать",
+ "UA": "скачать"
} \ No newline at end of file
diff --git a/expansions/allweb/gismeteo.name b/expansions/allweb/gismeteo.name
index 20376eb..dd2c327 100644
--- a/expansions/allweb/gismeteo.name
+++ b/expansions/allweb/gismeteo.name
@@ -1,4 +1,4 @@
-{
- "RU": "погода",
- "UA": "погода"
+{
+ "RU": "погода",
+ "UA": "погода"
} \ No newline at end of file
diff --git a/expansions/allweb/google.name b/expansions/allweb/google.name
index ede94f5..8a0c9cc 100644
--- a/expansions/allweb/google.name
+++ b/expansions/allweb/google.name
@@ -1,4 +1,4 @@
-{
- "RU": "гугл",
- "UA": "гугл"
+{
+ "RU": "гугл",
+ "UA": "гугл"
} \ No newline at end of file
diff --git a/expansions/allweb/imdb.name b/expansions/allweb/imdb.name
index 94dc1ec..84ed55b 100644
--- a/expansions/allweb/imdb.name
+++ b/expansions/allweb/imdb.name
@@ -1,4 +1,4 @@
-{
- "RU": "imdb",
- "UA": "imdb"
+{
+ "RU": "imdb",
+ "UA": "imdb"
} \ No newline at end of file
diff --git a/expansions/allweb/ithappens.name b/expansions/allweb/ithappens.name
index c951dda..77b9b28 100644
--- a/expansions/allweb/ithappens.name
+++ b/expansions/allweb/ithappens.name
@@ -1,4 +1,4 @@
-{
- "RU": "ит",
- "UA": "ит"
+{
+ "RU": "ит",
+ "UA": "ит"
} \ No newline at end of file
diff --git a/expansions/allweb/jc.name b/expansions/allweb/jc.name
index 4d566aa..657e7b8 100644
--- a/expansions/allweb/jc.name
+++ b/expansions/allweb/jc.name
@@ -1,4 +1,4 @@
-{
- "RU": "рейтинг",
- "UA": "рейтинг"
+{
+ "RU": "рейтинг",
+ "UA": "рейтинг"
} \ No newline at end of file
diff --git a/expansions/allweb/jquote.name b/expansions/allweb/jquote.name
index 5f76d66..bd42d3e 100644
--- a/expansions/allweb/jquote.name
+++ b/expansions/allweb/jquote.name
@@ -1,4 +1,4 @@
-{
- "RU": "цитата",
- "UA": "цитата"
+{
+ "RU": "цитата",
+ "UA": "цитата"
} \ No newline at end of file
diff --git a/expansions/allweb/kino.name b/expansions/allweb/kino.name
index f46f546..65a1660 100644
--- a/expansions/allweb/kino.name
+++ b/expansions/allweb/kino.name
@@ -1,4 +1,4 @@
-{
- "RU": "кино",
- "UA": "кино"
+{
+ "RU": "кино",
+ "UA": "кино"
} \ No newline at end of file
diff --git a/expansions/allweb/market.name b/expansions/allweb/market.name
index 85ca575..33b2782 100644
--- a/expansions/allweb/market.name
+++ b/expansions/allweb/market.name
@@ -1,4 +1,4 @@
-{
- "RU": "маркет",
- "UA": "маркет"
+{
+ "RU": "маркет",
+ "UA": "маркет"
} \ No newline at end of file
diff --git a/expansions/allweb/python.name b/expansions/allweb/python.name
index 89e1057..8a65f78 100644
--- a/expansions/allweb/python.name
+++ b/expansions/allweb/python.name
@@ -1,4 +1,4 @@
-{
- "RU": "питон",
- "UA": "питон"
+{
+ "RU": "питон",
+ "UA": "питон"
} \ No newline at end of file
diff --git a/expansions/allweb/shorten.name b/expansions/allweb/shorten.name
index 46b91c1..0242919 100644
--- a/expansions/allweb/shorten.name
+++ b/expansions/allweb/shorten.name
@@ -1,4 +1,4 @@
-{
- "RU": "сократи",
- "UA": "сократи"
+{
+ "RU": "сократи",
+ "UA": "сократи"
} \ No newline at end of file
diff --git a/expansions/allweb/tr.name b/expansions/allweb/tr.name
index 763cff5..8352e1b 100644
--- a/expansions/allweb/tr.name
+++ b/expansions/allweb/tr.name
@@ -1,4 +1,4 @@
-{
- "RU": "перевод",
- "UA": "перевод"
+{
+ "RU": "перевод",
+ "UA": "перевод"
} \ No newline at end of file
diff --git a/expansions/apocalypse/apocalypse.name b/expansions/apocalypse/apocalypse.name
index 35ee79f..a7cd142 100644
--- a/expansions/apocalypse/apocalypse.name
+++ b/expansions/apocalypse/apocalypse.name
@@ -1,4 +1,4 @@
-{
- "RU": "апокалипсис",
- "UA": "апокалипсис"
+{
+ "RU": "апокалипсис",
+ "UA": "апокалипсис"
} \ No newline at end of file
diff --git a/expansions/basic_control/code.py b/expansions/basic_control/code.py
index 31bf81b..8bffa46 100644
--- a/expansions/basic_control/code.py
+++ b/expansions/basic_control/code.py
@@ -17,7 +17,7 @@ class expansion_temp(expansion):
while Chats.has_key(conf):
if Chats[conf].IamHere != None:
break
- time.sleep(.4)
+ sleep(0.4)
if Numb.plus() >= 50:
break
@@ -73,7 +73,7 @@ class expansion_temp(expansion):
answer = self.AnsBase[2] % (conf)
else:
answer = self.AnsBase[3] % (conf)
- time.sleep(3.6)
+ sleep(3.6)
if ejoinTimerName(conf) in iThr.ThrNames():
answer += self.AnsBase[13]
else:
@@ -94,7 +94,7 @@ class expansion_temp(expansion):
if Chats.has_key(conf):
if online(Chats[conf].disp):
Chats[conf].leave(self.AnsBase[8] % (source[2]))
- time.sleep(2)
+ sleep(2)
Chats[conf].join()
self.Chat_check(conf)
if Chats.has_key(conf) and Chats[conf].IamHere:
@@ -119,7 +119,7 @@ class expansion_temp(expansion):
delivery(self.AnsBase[4] % (source[2], source_, conf))
info = self.AnsBase[9] % (source[2])
Message(conf, info, Chats[conf].disp)
- time.sleep(2)
+ sleep(2)
Chats[conf].full_leave(info)
if conf != source[1]:
answer = self.AnsBase[10] % (conf)
@@ -171,7 +171,7 @@ class expansion_temp(expansion):
exit_desclr += self.AnsBase[1] % (body)
for conf in Chats.keys():
Message(conf, exit_desclr, Chats[conf].disp)
- time.sleep(6)
+ sleep(6)
VarCache["alive"] = False
iThr.Threads_kill()
for disp in Clients.keys():
@@ -187,7 +187,7 @@ class expansion_temp(expansion):
exit_desclr += self.AnsBase[1] % (body)
for conf in Chats.keys():
Message(conf, exit_desclr, Chats[conf].disp)
- time.sleep(6)
+ sleep(6)
VarCache["alive"] = False
iThr.Threads_kill()
for disp in Clients.keys():
diff --git a/expansions/basic_control/exit.name b/expansions/basic_control/exit.name
index 6c62134..dc51d91 100644
--- a/expansions/basic_control/exit.name
+++ b/expansions/basic_control/exit.name
@@ -1,4 +1,4 @@
-{
- "RU": "выкл",
- "UA": "выкл"
+{
+ "RU": "выкл",
+ "UA": "выкл"
} \ No newline at end of file
diff --git a/expansions/basic_control/join.name b/expansions/basic_control/join.name
index 56cf18b..bbc6f79 100644
--- a/expansions/basic_control/join.name
+++ b/expansions/basic_control/join.name
@@ -1,4 +1,4 @@
-{
- "RU": "джойн",
- "UA": "джойн"
+{
+ "RU": "джойн",
+ "UA": "джойн"
} \ No newline at end of file
diff --git a/expansions/basic_control/leave.name b/expansions/basic_control/leave.name
index 340422c..f84bd70 100644
--- a/expansions/basic_control/leave.name
+++ b/expansions/basic_control/leave.name
@@ -1,4 +1,4 @@
-{
- "RU": "выйди",
- "UA": "выйди"
+{
+ "RU": "выйди",
+ "UA": "выйди"
} \ No newline at end of file
diff --git a/expansions/basic_control/reconnect.name b/expansions/basic_control/reconnect.name
index ba58f12..f637b97 100644
--- a/expansions/basic_control/reconnect.name
+++ b/expansions/basic_control/reconnect.name
@@ -1,4 +1,4 @@
-{
- "RU": "реконнект",
- "UA": "реконнект"
+{
+ "RU": "реконнект",
+ "UA": "реконнект"
} \ No newline at end of file
diff --git a/expansions/basic_control/rejoin.name b/expansions/basic_control/rejoin.name
index fc75f13..8dd5361 100644
--- a/expansions/basic_control/rejoin.name
+++ b/expansions/basic_control/rejoin.name
@@ -1,4 +1,4 @@
-{
- "RU": "реджойн",
- "UA": "реджойн"
+{
+ "RU": "реджойн",
+ "UA": "реджойн"
} \ No newline at end of file
diff --git a/expansions/basic_control/reload.name b/expansions/basic_control/reload.name
index 0acfe12..9fde7d1 100644
--- a/expansions/basic_control/reload.name
+++ b/expansions/basic_control/reload.name
@@ -1,4 +1,4 @@
-{
- "RU": "рестарт",
- "UA": "рестарт"
+{
+ "RU": "рестарт",
+ "UA": "рестарт"
} \ No newline at end of file
diff --git a/expansions/books/books.name b/expansions/books/books.name
index 6198279..0461b50 100644
--- a/expansions/books/books.name
+++ b/expansions/books/books.name
@@ -1,4 +1,4 @@
-{
- "RU": "книги",
- "UA": "книги"
+{
+ "RU": "книги",
+ "UA": "книги"
} \ No newline at end of file
diff --git a/expansions/books/code.py b/expansions/books/code.py
index c049ae0..eb778ef 100644
--- a/expansions/books/code.py
+++ b/expansions/books/code.py
@@ -1,8 +1,8 @@
# coding: utf-8
# BlackSmith mark.2
-exp_name = "books" # /code.py v.x6 alpha
-# Id: 29~6b
+exp_name = "books" # /code.py v.x7 beta
+# Id: 29~7b
# Code © (2011-2012) by WitcherGeralt [alkorgun@gmail.com]
expansion_register(exp_name)
@@ -129,6 +129,8 @@ class expansion_temp(expansion):
if db_desc:
ls, Numb = [a3 + ":"], itypes.Number()
for seq1, seq2, Name in db_desc:
+ if not seq2:
+ seq2 = 0
ls.append("%d) %s #%d - %s" % (Numb.plus(), seq1, seq2, Name))
answer = str.join(chr(10), ls)
else:
diff --git a/expansions/books/library.name b/expansions/books/library.name
index 42b36a7..104e8c9 100644
--- a/expansions/books/library.name
+++ b/expansions/books/library.name
@@ -1,4 +1,4 @@
-{
- "RU": "библиотека",
- "UA": "библиотека"
+{
+ "RU": "библиотека",
+ "UA": "библиотека"
} \ No newline at end of file
diff --git a/expansions/bot_sends/clear.name b/expansions/bot_sends/clear.name
index 73cd152..5bdf55c 100644
--- a/expansions/bot_sends/clear.name
+++ b/expansions/bot_sends/clear.name
@@ -1,4 +1,4 @@
-{
- "RU": "чисть",
- "UA": "чисть"
+{
+ "RU": "чисть",
+ "UA": "чисть"
} \ No newline at end of file
diff --git a/expansions/bot_sends/code.py b/expansions/bot_sends/code.py
index 808e9be..f691bf9 100644
--- a/expansions/bot_sends/code.py
+++ b/expansions/bot_sends/code.py
@@ -26,7 +26,7 @@ class expansion_temp(expansion):
raise SelfExc("exit")
Sender(disp, zero); Info["omsg"].plus()
if (Numb != 23):
- time.sleep(1.4)
+ sleep(1.4)
if ltype == Types[1]:
Chats[source[1]].change_status(s1_backup, s2_backup)
ChatsAttrs[source[1]]["dirt"] = True
diff --git a/expansions/bot_sends/invite.name b/expansions/bot_sends/invite.name
index eef4715..ef45b5b 100644
--- a/expansions/bot_sends/invite.name
+++ b/expansions/bot_sends/invite.name
@@ -1,4 +1,4 @@
-{
- "RU": "пригласи",
- "UA": "пригласи"
+{
+ "RU": "пригласи",
+ "UA": "пригласи"
} \ No newline at end of file
diff --git a/expansions/bot_sends/more.name b/expansions/bot_sends/more.name
index 3d97b7c..569793b 100644
--- a/expansions/bot_sends/more.name
+++ b/expansions/bot_sends/more.name
@@ -1,4 +1,4 @@
-{
- "RU": "далее",
- "UA": "далее"
+{
+ "RU": "далее",
+ "UA": "далее"
} \ No newline at end of file
diff --git a/expansions/bot_sends/say.name b/expansions/bot_sends/say.name
index e584170..d0aa7da 100644
--- a/expansions/bot_sends/say.name
+++ b/expansions/bot_sends/say.name
@@ -1,4 +1,4 @@
-{
- "RU": "сказать",
- "UA": "сказать"
+{
+ "RU": "сказать",
+ "UA": "сказать"
} \ No newline at end of file
diff --git a/expansions/bot_sends/send.name b/expansions/bot_sends/send.name
index ec1c91d..67a0c09 100644
--- a/expansions/bot_sends/send.name
+++ b/expansions/bot_sends/send.name
@@ -1,4 +1,4 @@
-{
- "RU": "сообщение",
- "UA": "сообщение"
+{
+ "RU": "сообщение",
+ "UA": "сообщение"
} \ No newline at end of file
diff --git a/expansions/bot_sends/sendall.name b/expansions/bot_sends/sendall.name
index 7594b38..5601c4a 100644
--- a/expansions/bot_sends/sendall.name
+++ b/expansions/bot_sends/sendall.name
@@ -1,4 +1,4 @@
-{
- "RU": "разослать",
- "UA": "разослать"
+{
+ "RU": "разослать",
+ "UA": "разослать"
} \ No newline at end of file
diff --git a/expansions/bot_sends/test.name b/expansions/bot_sends/test.name
index 176d090..6ef49f6 100644
--- a/expansions/bot_sends/test.name
+++ b/expansions/bot_sends/test.name
@@ -1,4 +1,4 @@
-{
- "RU": "тест",
- "UA": "тест"
+{
+ "RU": "тест",
+ "UA": "тест"
} \ No newline at end of file
diff --git a/expansions/bot_sends/toadmin.name b/expansions/bot_sends/toadmin.name
index 49b6b98..d4788cb 100644
--- a/expansions/bot_sends/toadmin.name
+++ b/expansions/bot_sends/toadmin.name
@@ -1,4 +1,4 @@
-{
- "RU": "суперадмину",
- "UA": "суперадмину"
+{
+ "RU": "суперадмину",
+ "UA": "суперадмину"
} \ No newline at end of file
diff --git a/expansions/calendar/calendar.name b/expansions/calendar/calendar.name
index e2e4048..df93cdc 100644
--- a/expansions/calendar/calendar.name
+++ b/expansions/calendar/calendar.name
@@ -1,4 +1,4 @@
-{
- "RU": "календарь",
- "UA": "календарь"
+{
+ "RU": "календарь",
+ "UA": "календарь"
} \ No newline at end of file
diff --git a/expansions/cmd_control/taboo.name b/expansions/cmd_control/taboo.name
index 07deea1..d67fc87 100644
--- a/expansions/cmd_control/taboo.name
+++ b/expansions/cmd_control/taboo.name
@@ -1,4 +1,4 @@
-{
- "RU": "табу",
- "UA": "табу"
+{
+ "RU": "табу",
+ "UA": "табу"
} \ No newline at end of file
diff --git a/expansions/config/client.name b/expansions/config/client.name
index 58fa5ca..1157817 100644
--- a/expansions/config/client.name
+++ b/expansions/config/client.name
@@ -1,4 +1,4 @@
-{
- "RU": "клиент",
- "UA": "клиент"
+{
+ "RU": "клиент",
+ "UA": "клиент"
} \ No newline at end of file
diff --git a/expansions/config/code.py b/expansions/config/code.py
index f9db272..822042e 100644
--- a/expansions/config/code.py
+++ b/expansions/config/code.py
@@ -103,11 +103,11 @@ class expansion_temp(expansion):
if Chats[conf].disp == Name:
if online(Name):
Message(conf, self.AnsBase[4], Name)
- time.sleep(0.2)
+ sleep(0.2)
Chats[conf].leave(self.AnsBase[5])
Chats[conf].disp = IdleClient()
Chats[conf].save()
- time.sleep(0.6)
+ sleep(0.6)
Chats[conf].join()
if online(Name):
try:
diff --git a/expansions/config/config.name b/expansions/config/config.name
index 6af7210..8491cfc 100644
--- a/expansions/config/config.name
+++ b/expansions/config/config.name
@@ -1,4 +1,4 @@
-{
- "RU": "конфиг",
- "UA": "конфиг"
+{
+ "RU": "конфиг",
+ "UA": "конфиг"
} \ No newline at end of file
diff --git a/expansions/converter/convert.name b/expansions/converter/convert.name
index d55ef11..f17b582 100644
--- a/expansions/converter/convert.name
+++ b/expansions/converter/convert.name
@@ -1,4 +1,4 @@
-{
- "RU": "convert",
- "UA": "convert"
+{
+ "RU": "convert",
+ "UA": "convert"
} \ No newline at end of file
diff --git a/expansions/cron/code.py b/expansions/cron/code.py
index 58e3899..e9e618e 100644
--- a/expansions/cron/code.py
+++ b/expansions/cron/code.py
@@ -32,7 +32,7 @@ class expansion_temp(expansion):
self.CronDesc[self.CronCounter.plus()] = ((seconds + gt), (command, instance, ls, repeat))
while VarCache["alive"]:
- time.sleep(2)
+ sleep(2)
if not expansions.has_key(self.name):
break
Time = time.mktime(time.gmtime())
diff --git a/expansions/cron/cron.name b/expansions/cron/cron.name
index 56d64e8..e777906 100644
--- a/expansions/cron/cron.name
+++ b/expansions/cron/cron.name
@@ -1,4 +1,4 @@
-{
- "RU": "хрон",
- "UA": "хрон"
+{
+ "RU": "хрон",
+ "UA": "хрон"
} \ No newline at end of file
diff --git a/expansions/exp_control/expinfo.name b/expansions/exp_control/expinfo.name
index c9bd5c5..f400807 100644
--- a/expansions/exp_control/expinfo.name
+++ b/expansions/exp_control/expinfo.name
@@ -1,4 +1,4 @@
-{
- "RU": "плагинфо",
- "UA": "плагинфо"
+{
+ "RU": "плагинфо",
+ "UA": "плагинфо"
} \ No newline at end of file
diff --git a/expansions/exp_control/expload.name b/expansions/exp_control/expload.name
index bcf689a..427ddd8 100644
--- a/expansions/exp_control/expload.name
+++ b/expansions/exp_control/expload.name
@@ -1,4 +1,4 @@
-{
- "RU": "подгрузи",
- "UA": "подгрузи"
+{
+ "RU": "подгрузи",
+ "UA": "подгрузи"
} \ No newline at end of file
diff --git a/expansions/exp_control/expunload.name b/expansions/exp_control/expunload.name
index 8543011..e74cb2a 100644
--- a/expansions/exp_control/expunload.name
+++ b/expansions/exp_control/expunload.name
@@ -1,4 +1,4 @@
-{
- "RU": "выгрузи",
- "UA": "выгрузи"
+{
+ "RU": "выгрузи",
+ "UA": "выгрузи"
} \ No newline at end of file
diff --git a/expansions/exp_control/insc.py b/expansions/exp_control/insc.py
index dc0c1a4..b5eac4e 100644
--- a/expansions/exp_control/insc.py
+++ b/expansions/exp_control/insc.py
@@ -2,7 +2,7 @@
if DefLANG in ("RU", "UA"):
AnsBase_temp = tuple([line.decode("utf-8") for line in (
- "\n[Название][состояние][файл кода][файл языка]", # 0
+ "\n[Название][состояние][файл кода][языковой файл]", # 0
"в наличии", # 1
"отсутствует", # 2
"загружен", # 3
diff --git a/expansions/exp_control/tumbler.name b/expansions/exp_control/tumbler.name
index 7de3d67..3b5762d 100644
--- a/expansions/exp_control/tumbler.name
+++ b/expansions/exp_control/tumbler.name
@@ -1,4 +1,4 @@
-{
- "RU": "тумблер",
- "UA": "тумблер"
+{
+ "RU": "тумблер",
+ "UA": "тумблер"
} \ No newline at end of file
diff --git a/expansions/extra_control/code.py b/expansions/extra_control/code.py
index 4b7cc2f..7df496b 100644
--- a/expansions/extra_control/code.py
+++ b/expansions/extra_control/code.py
@@ -30,7 +30,7 @@ class expansion_temp(expansion):
body = ""
Cmds[cmd].execute(ltype, source, body, disp)
if numb not in (0, lslen):
- time.sleep(2)
+ sleep(2)
else:
answer = AnsBase[6]
else:
diff --git a/expansions/extra_control/private.name b/expansions/extra_control/private.name
index 0956105..8ef1ee2 100644
--- a/expansions/extra_control/private.name
+++ b/expansions/extra_control/private.name
@@ -1,4 +1,4 @@
-{
- "RU": "приват",
- "UA": "приват"
+{
+ "RU": "приват",
+ "UA": "приват"
} \ No newline at end of file
diff --git a/expansions/extra_control/remote.name b/expansions/extra_control/remote.name
index d49490c..3ae402e 100644
--- a/expansions/extra_control/remote.name
+++ b/expansions/extra_control/remote.name
@@ -1,4 +1,4 @@
-{
- "RU": "ремоут",
- "UA": "ремоут"
+{
+ "RU": "ремоут",
+ "UA": "ремоут"
} \ No newline at end of file
diff --git a/expansions/extra_control/turbo.name b/expansions/extra_control/turbo.name
index 9a83b0a..8ea837f 100644
--- a/expansions/extra_control/turbo.name
+++ b/expansions/extra_control/turbo.name
@@ -1,4 +1,4 @@
-{
- "RU": "турбо",
- "UA": "турбо"
+{
+ "RU": "турбо",
+ "UA": "турбо"
} \ No newline at end of file
diff --git a/expansions/game/code.py b/expansions/game/code.py
index d9befd9..fc769d4 100644
--- a/expansions/game/code.py
+++ b/expansions/game/code.py
@@ -43,7 +43,7 @@ class expansion_temp(expansion):
if self.GameDesc.has_key(Char):
Char_2 = choice(self.GameDesc.keys())
Answer(Char_2, ltype, source, disp)
- time.sleep(3.2)
+ sleep(3.2)
if Char == Char_2:
answer = self.AnsBase[0]
elif self.GameDesc[Char_2].has_key(Char):
diff --git a/expansions/game/game.name b/expansions/game/game.name
index df0e245..8f2233f 100644
--- a/expansions/game/game.name
+++ b/expansions/game/game.name
@@ -1,4 +1,4 @@
-{
- "RU": "игра",
- "UA": "игра"
+{
+ "RU": "игра",
+ "UA": "игра"
} \ No newline at end of file
diff --git a/expansions/get_iq/code.py b/expansions/get_iq/code.py
index c9fce7c..87e0d2f 100644
--- a/expansions/get_iq/code.py
+++ b/expansions/get_iq/code.py
@@ -1,8 +1,8 @@
# coding: utf-8
# BlackSmith mark.2
-exp_name = "get_iq" # /code.py v.x5
-# Id: 13~4b
+exp_name = "get_iq" # /code.py v.x6
+# Id: 13~5b
# Code © (2010-2011) by WitcherGeralt [alkorgun@gmail.com]
expansion_register(exp_name)
@@ -29,15 +29,15 @@ class expansion_temp(expansion):
iq.setID("Bs-i%d" % Info["outiq"].plus())
CallForResponse(disp, iq, self.answer_ping, {"ltype": ltype, "source": source, "instance": instance, "source_": source_, "start": time.time()})
- PingStat = {}
+ PingStats = {}
def answer_ping(self, disp, stanza, ltype, source, instance, source_, start):
if xmpp.isResultNode(stanza):
answer = round(time.time() - start, 3)
if source_:
- if not self.PingStat.has_key(source_):
- self.PingStat[source_] = []
- self.PingStat[source_].append(answer)
+ if not self.PingStats.has_key(source_):
+ self.PingStats[source_] = []
+ self.PingStats[source_].append(answer)
Answer(self.AnsBase[0] % str(answer), ltype, source, disp)
else:
iq = xmpp.Iq(to = instance, typ = Types[10])
@@ -49,21 +49,21 @@ class expansion_temp(expansion):
if xmpp.isResultNode(stanza):
answer = round(time.time() - start, 3)
if source_:
- if not self.PingStat.has_key(source_):
- self.PingStat[source_] = []
- self.PingStat[source_].append(answer)
+ if not self.PingStats.has_key(source_):
+ self.PingStats[source_] = []
+ self.PingStats[source_].append(answer)
Name = "[None]"
- for x in stanza.getQueryChildren():
- xname = x.getName()
- if xname == "name":
- Name = x.getData()
+ for node in stanza.getQueryChildren():
+ name = node.getName()
+ if name == "name":
+ Name = node.getData()
break
answer = self.AnsBase[1] % (Name, str(answer))
else:
answer = self.AnsBase[2]
Answer(answer, ltype, source, disp)
- def command_ping_stat(self, ltype, source, source_, disp):
+ def command_ping_stats(self, ltype, source, source_, disp):
if source_:
if Chats.has_key(source[1]) and Chats[source[1]].isHere(source_):
source_ = get_source(source[1], source_)
@@ -71,11 +71,11 @@ class expansion_temp(expansion):
source_ = source_.lower()
else:
source_ = get_source(source[1], source[2])
- if source_ and self.PingStat.has_key(source_):
- Number = float(sum(self.PingStat[source_]))
- len_ = len(self.PingStat[source_])
- max_ = max(self.PingStat[source_])
- min_ = min(self.PingStat[source_])
+ if source_ and self.PingStats.has_key(source_):
+ Number = float(sum(self.PingStats[source_]))
+ len_ = len(self.PingStats[source_])
+ max_ = max(self.PingStats[source_])
+ min_ = min(self.PingStats[source_])
if len_:
answer = self.AnsBase[3] % (str(len_), str(min_), str(max_), str(round(Number / len_, 3)))
else:
@@ -85,39 +85,96 @@ class expansion_temp(expansion):
Answer(answer, ltype, source, disp)
def command_version(self, ltype, source, instance, disp):
- if Chats.has_key(source[1]):
- if instance:
- if Chats.has_key(source[1]) and Chats[source[1]].isHere(instance):
- if Chats[source[1]].isHereTS(instance):
- instance = "%s/%s" % (source[1], instance)
- else:
- Answer(self.AnsBase[5] % (instance), ltype, source, disp)
- raise iThr.ThrKill("exit")
- else:
- instance = source[0]
- iq = xmpp.Iq(to = instance, typ = Types[10])
- iq.addChild(Types[18], {}, [], xmpp.NS_VERSION)
- iq.setID("Bs-i%d" % Info["outiq"].plus())
- CallForResponse(disp, iq, self.answer_version, {"ltype": ltype, "source": source})
+ if instance:
+ if Chats.has_key(source[1]) and Chats[source[1]].isHere(instance):
+ if Chats[source[1]].isHereTS(instance):
+ instance = "%s/%s" % (source[1], instance)
+ else:
+ Answer(self.AnsBase[5] % (instance), ltype, source, disp)
+ raise iThr.ThrKill("exit")
else:
- Answer(AnsBase[0], ltype, source, disp)
+ instance = source[0]
+ iq = xmpp.Iq(to = instance, typ = Types[10])
+ iq.addChild(Types[18], {}, [], xmpp.NS_VERSION)
+ iq.setID("Bs-i%d" % Info["outiq"].plus())
+ CallForResponse(disp, iq, self.answer_version, {"ltype": ltype, "source": source})
def answer_version(self, disp, stanza, ltype, source):
if xmpp.isResultNode(stanza):
Name, Ver, Os = "[None]", "[None]", "[None]"
- for x in stanza.getQueryChildren():
- xname = x.getName()
- if xname == "name":
- Name = x.getData()
- elif xname == "version":
- Ver = x.getData()
- elif xname == "os":
- Os = x.getData()
+ for node in stanza.getQueryChildren():
+ name = node.getName()
+ if name == "name":
+ Name = node.getData()
+ elif name == "version":
+ Ver = node.getData()
+ elif name == "os":
+ Os = node.getData()
answer = "\nName: %s\nVer.: %s\nOS: %s" % (Name, Ver, Os)
else:
answer = self.AnsBase[6]
Answer(answer, ltype, source, disp)
+ def command_vcard(self, ltype, source, instance, disp):
+ if instance:
+ if Chats.has_key(source[1]) and Chats[source[1]].isHere(instance):
+ if Chats[source[1]].isHereTS(instance):
+ instance = "%s/%s" % (source[1], instance)
+ else:
+ Answer(self.AnsBase[5] % (instance), ltype, source, disp)
+ raise iThr.ThrKill("exit")
+ else:
+ instance = source[0]
+ iq = xmpp.Iq(to = instance, typ = Types[10])
+ iq.addChild(Types[18], {}, [], xmpp.NS_VCARD)
+ iq.setID("Bs-i%d" % Info["outiq"].plus())
+ CallForResponse(disp, iq, self.answer_vcard, {"ltype": ltype, "source": source})
+
+ VcardDesc = {
+ "NICKNAME": "Nick",
+ "GIVEN": "Name",
+ "FAMILY": "Surname",
+ "BDAY": "Birthday",
+ "FN": "Full Name",
+ "USERID": "e-Mail",
+ "URL": "Web Page",
+ "DESC": "Description",
+ "NUMBER": "Phone",
+ "EXTADR": "Address",
+ "PCODE": "Post Code",
+ "LOCALITY": "City",
+ "CTRY": "Country",
+ "ORGNAME": "Organization Name",
+ "ORGUNIT": "Organization Unit"
+ }
+
+ def parse_vcard(self, node, ls):
+ if node.kids:
+ for node in node.getChildren():
+ name = node.getName()
+ if name == "PHOTO":
+ continue
+ self.parse_vcard(node, ls)
+ else:
+ data = (node.getData()).strip()
+ if data and len(data) <= 512:
+ name = node.getName()
+ name = self.VcardDesc.get(name, name.capitalize())
+ ls.append("%s: %s" % (name, data))
+
+ def answer_vcard(self, disp, stanza, ltype, source):
+ if xmpp.isResultNode(stanza):
+ ls = []
+ self.parse_vcard(stanza, ls)
+ if ls:
+ ls.insert(0, "\->")
+ answer = str.join(chr(10), ls)
+ else:
+ answer = self.AnsBase[10]
+ else:
+ answer = self.AnsBase[6]
+ Answer(answer, ltype, source, disp)
+
def command_uptime(self, ltype, source, server, disp):
if not server:
server = InstansesDesc[Gen_disp][0]
@@ -182,7 +239,7 @@ class expansion_temp(expansion):
iq.setID("Bs-i%d" % Info["outiq"].plus())
CallForResponse(disp, iq, self.answer_aflist_search, {"desc": desc, "name": name, "data": data})
for x in xrange(60):
- time.sleep(0.2)
+ sleep(0.2)
if len(desc.keys()) == 4:
break
Number = itypes.Number()
@@ -230,32 +287,30 @@ class expansion_temp(expansion):
def answer_aflist_search(self, disp, stanza, desc, name, data):
if xmpp.isResultNode(stanza):
count = []
- for node in stanza.getChildren():
- for node in node.getChildren():
- if node and node != "None":
- jid = node.getAttr("jid")
- if jid and jid.count(data):
- signature = node.getTagData("reason")
- if signature:
- jid = "%s (%s)" % (jid, signature)
- count.append(jid)
+ for node in stanza.getQueryChildren():
+ if node and node != "None":
+ jid = node.getAttr("jid")
+ if jid and jid.count(data):
+ signature = node.getTagData("reason")
+ if signature:
+ jid = "%s (%s)" % (jid, signature)
+ count.append(jid)
desc[name] = count
def answer_aflist(self, disp, stanza, ltype, source, Numb):
if xmpp.isResultNode(stanza):
ls, Number = [], itypes.Number()
- for node in stanza.getChildren():
- for node in node.getChildren():
- if node and node != "None":
- jid = node.getAttr("jid")
- if jid:
- if Numb and Numb <= Number._int():
- Number.plus()
- else:
- signature = node.getTagData("reason")
- if signature:
- jid = "%s (%s)" % (jid, signature)
- ls.append("%d) %s" % (Number.plus(), jid))
+ for node in stanza.getQueryChildren():
+ if node and node != "None":
+ jid = node.getAttr("jid")
+ if jid:
+ if Numb and Numb <= Number._int():
+ Number.plus()
+ else:
+ signature = node.getTagData("reason")
+ if signature:
+ jid = "%s (%s)" % (jid, signature)
+ ls.append("%d) %s" % (Number.plus(), jid))
if ls:
if Numb and Numb < Number._int():
ls.append("...\nTotal: %s items." % (Number._str()))
@@ -269,11 +324,47 @@ class expansion_temp(expansion):
if locals().has_key(Types[12]):
Answer(answer, ltype, source, disp)
+ def command_server_stats(self, ltype, source, instance, disp):
+ if not instance:
+ instance = disp._owner.Server
+ iq = xmpp.Iq(to = instance, typ = Types[10])
+ iq.addChild(Types[18], {}, [], xmpp.NS_STATS)
+ iq.setID("Bs-i%d" % Info["outiq"].plus())
+ CallForResponse(disp, iq, self.answer_server_stats, {"ltype": ltype, "source": source})
+
+ def answer_server_stats(self, disp, stanza, ltype, source):
+ if xmpp.isResultNode(stanza):
+ iq = xmpp.Iq(to = stanza.getFrom(), typ = Types[10])
+ iq.addChild(Types[18], {}, stanza.getQueryChildren(), xmpp.NS_STATS)
+ iq.setID("Bs-i%d" % Info["outiq"].plus())
+ CallForResponse(disp, iq, self.answer_server_stats_get, {"ltype": ltype, "source": source})
+ else:
+ Answer(self.AnsBase[6], ltype, source, disp)
+
+ def answer_server_stats_get(self, disp, stanza, ltype, source):
+ if xmpp.isResultNode(stanza):
+ ls = []
+ for node in stanza.getQueryChildren():
+ name = node.getAttr("name")
+ value = node.getAttr("value")
+ if name and value:
+ ls.append("%s: %s" % (name, value))
+ if ls:
+ ls.insert(0, "Stats of %s ->" % stanza.getFrom())
+ answer = str.join(chr(10), ls)
+ else:
+ answer = self.AnsBase[4]
+ else:
+ answer = self.AnsBase[6]
+ Answer(answer, ltype, source, disp)
+
commands = (
(command_ping, "ping", 1,),
- (command_ping_stat, "pstat", 1,),
+ (command_ping_stats, "pstat", 1,),
(command_version, "version", 1,),
+ (command_vcard, "vcard", 1,),
(command_uptime, "uptime", 1,),
(command_idle, "idle", 1,),
- (command_aflist, "list", 4,)
+ (command_aflist, "list", 4,),
+ (command_server_stats, "servstat", 1,)
)
diff --git a/expansions/get_iq/idle.name b/expansions/get_iq/idle.name
index 25fcfd2..3609c28 100644
--- a/expansions/get_iq/idle.name
+++ b/expansions/get_iq/idle.name
@@ -1,4 +1,4 @@
-{
- "RU": "жив",
- "UA": "жив"
+{
+ "RU": "жив",
+ "UA": "жив"
} \ No newline at end of file
diff --git a/expansions/get_iq/insc.py b/expansions/get_iq/insc.py
index 64df36e..60ffeb2 100644
--- a/expansions/get_iq/insc.py
+++ b/expansions/get_iq/insc.py
@@ -11,7 +11,8 @@ if DefLANG in ("RU", "UA"):
"Нет ответа.", # 6
"Время работы «%s» - %s.", # 7
"Послеедняя активность «%s» - %s назад.", # 8
- "Нет cовпадений." # 9
+ "Нет cовпадений.", # 9
+ "Вкард не заполнен." # 10
)])
else:
AnsBase_temp = (
@@ -24,5 +25,6 @@ else:
"No answer.", # 6
"%s's uptime is %s.", # 7
"%s's last activity was %s ago.", # 8
- "No matches." # 9
+ "No matches.", # 9
+ "The vCard is empty." # 10
) \ No newline at end of file
diff --git a/expansions/get_iq/list.name b/expansions/get_iq/list.name
index 118aee3..139c3b6 100644
--- a/expansions/get_iq/list.name
+++ b/expansions/get_iq/list.name
@@ -1,4 +1,4 @@
-{
- "RU": "список",
- "UA": "список"
+{
+ "RU": "список",
+ "UA": "список"
} \ No newline at end of file
diff --git a/expansions/get_iq/ping.name b/expansions/get_iq/ping.name
index 588895b..dcef63a 100644
--- a/expansions/get_iq/ping.name
+++ b/expansions/get_iq/ping.name
@@ -1,4 +1,4 @@
-{
- "RU": "пинг",
- "UA": "пинг"
+{
+ "RU": "пинг",
+ "UA": "пинг"
} \ No newline at end of file
diff --git a/expansions/get_iq/pingstat.en b/expansions/get_iq/pingstat.en
deleted file mode 100644
index 9c7a57b..0000000
--- a/expansions/get_iq/pingstat.en
+++ /dev/null
@@ -1,8 +0,0 @@
-xmpp ping statistics
-pingstat (nick/jid)
-*/pingstat
-bot would show your statistics
-*/pingstat Dude
-bot would show Dude's statistics
-*/pingstat dude@jabr.com
-bot would show the statistics of dude@jabr.com \ No newline at end of file
diff --git a/expansions/get_iq/pingstat.ru b/expansions/get_iq/pingstat.ru
deleted file mode 100644
index 2fc0c1c..0000000
--- a/expansions/get_iq/pingstat.ru
+++ /dev/null
@@ -1,8 +0,0 @@
-статистика xmpp пинга
-пингстат (nick/jid)
-*/пингстат
-бот покажет вашу статистику
-*/пингстат Dude
-бот покажет статистику "Dude"
-*/пингстат dude@jab.ru
-бот покажет статистику "dude@jab.ru" \ No newline at end of file
diff --git a/expansions/get_iq/pstat.name b/expansions/get_iq/pstat.name
index 1ee338d..1d7af78 100644
--- a/expansions/get_iq/pstat.name
+++ b/expansions/get_iq/pstat.name
@@ -1,4 +1,4 @@
-{
- "RU": "пингстат",
- "UA": "пингстат"
+{
+ "RU": "пингстат",
+ "UA": "пингстат"
} \ No newline at end of file
diff --git a/expansions/get_iq/servstat.en b/expansions/get_iq/servstat.en
new file mode 100644
index 0000000..91d4a28
--- /dev/null
+++ b/expansions/get_iq/servstat.en
@@ -0,0 +1,6 @@
+statistics of jabber servers
+servstat (server)
+*/servstat
+bot would show statistics of it's current jid's server
+*/servstat jabr.com
+bot would show statistics of jabr.com \ No newline at end of file
diff --git a/expansions/get_iq/servstat.name b/expansions/get_iq/servstat.name
new file mode 100644
index 0000000..de0c49c
--- /dev/null
+++ b/expansions/get_iq/servstat.name
@@ -0,0 +1,4 @@
+{
+ "RU": "сервстат",
+ "UA": "сервстат"
+} \ No newline at end of file
diff --git a/expansions/get_iq/servstat.ru b/expansions/get_iq/servstat.ru
new file mode 100644
index 0000000..fb6198e
--- /dev/null
+++ b/expansions/get_iq/servstat.ru
@@ -0,0 +1,6 @@
+статистика jabber сервера
+сервстат (server)
+*/сервстат
+бот покажет статистику сервера своего текущего jid'а
+*/сервстат jab.com
+бот покажет статистику "jab.com" \ No newline at end of file
diff --git a/expansions/get_iq/uptime.name b/expansions/get_iq/uptime.name
index 0c5d75b..ec4979a 100644
--- a/expansions/get_iq/uptime.name
+++ b/expansions/get_iq/uptime.name
@@ -1,4 +1,4 @@
-{
- "RU": "аптайм",
- "UA": "аптайм"
+{
+ "RU": "аптайм",
+ "UA": "аптайм"
} \ No newline at end of file
diff --git a/expansions/get_iq/vcard.en b/expansions/get_iq/vcard.en
new file mode 100644
index 0000000..c91e0d0
--- /dev/null
+++ b/expansions/get_iq/vcard.en
@@ -0,0 +1,8 @@
+xmpp vCard
+vcard (nick/jid)
+*/vcard
+bot would show your vCard
+*/vcard Dude
+bot would show Dude's vCard
+*/vcard dude@jabr.com
+bot would show vCard of dude@jabr.com \ No newline at end of file
diff --git a/expansions/get_iq/vcard.name b/expansions/get_iq/vcard.name
new file mode 100644
index 0000000..761a358
--- /dev/null
+++ b/expansions/get_iq/vcard.name
@@ -0,0 +1,4 @@
+{
+ "RU": "вкард",
+ "UA": "вкард"
+} \ No newline at end of file
diff --git a/expansions/get_iq/vcard.ru b/expansions/get_iq/vcard.ru
new file mode 100644
index 0000000..c302c44
--- /dev/null
+++ b/expansions/get_iq/vcard.ru
@@ -0,0 +1,8 @@
+xmpp vCard
+вкард (nick/jid)
+*/вкард
+бот покажет ваш vCard
+*/вкард Dude
+бот покажет vCard "Dude"
+*/вкард dude@jab.com
+бот покажет vCard "dude@jab.com" \ No newline at end of file
diff --git a/expansions/get_iq/version.en b/expansions/get_iq/version.en
index 2f64bde..17a0cf4 100644
--- a/expansions/get_iq/version.en
+++ b/expansions/get_iq/version.en
@@ -1,4 +1,4 @@
-client(server)'s version
+xmpp version
version (nick/jid)
*/version
bot would show your client's version
diff --git a/expansions/get_iq/version.name b/expansions/get_iq/version.name
index 4d8d245..81c8ac5 100644
--- a/expansions/get_iq/version.name
+++ b/expansions/get_iq/version.name
@@ -1,4 +1,4 @@
-{
- "RU": "версия",
- "UA": "версия"
+{
+ "RU": "версия",
+ "UA": "версия"
} \ No newline at end of file
diff --git a/expansions/get_iq/version.ru b/expansions/get_iq/version.ru
index 3d852f7..71dac9d 100644
--- a/expansions/get_iq/version.ru
+++ b/expansions/get_iq/version.ru
@@ -1,4 +1,4 @@
-версия клиента(сервера)
+xmpp версия
версия (nick/jid)
*/версия
бот покажет версию вашего клиента
diff --git a/expansions/help/comacc.name b/expansions/help/comacc.name
index 2885623..52801a1 100644
--- a/expansions/help/comacc.name
+++ b/expansions/help/comacc.name
@@ -1,4 +1,4 @@
-{
- "RU": "комдоступ",
- "UA": "комдоступ"
+{
+ "RU": "комдоступ",
+ "UA": "комдоступ"
} \ No newline at end of file
diff --git a/expansions/help/commands.name b/expansions/help/commands.name
index d6b3a3b..d02ab5d 100644
--- a/expansions/help/commands.name
+++ b/expansions/help/commands.name
@@ -1,4 +1,4 @@
-{
- "RU": "комлист",
- "UA": "комлист"
+{
+ "RU": "комлист",
+ "UA": "комлист"
} \ No newline at end of file
diff --git a/expansions/help/help.name b/expansions/help/help.name
index 9d8c0a6..4d25d66 100644
--- a/expansions/help/help.name
+++ b/expansions/help/help.name
@@ -1,4 +1,4 @@
-{
- "RU": "хелп",
- "UA": "хелп"
+{
+ "RU": "хелп",
+ "UA": "хелп"
} \ No newline at end of file
diff --git a/expansions/help/location.name b/expansions/help/location.name
index 8d5f500..3c3777a 100644
--- a/expansions/help/location.name
+++ b/expansions/help/location.name
@@ -1,4 +1,4 @@
-{
- "RU": "дислокация",
- "UA": "дислокация"
+{
+ "RU": "дислокация",
+ "UA": "дислокация"
} \ No newline at end of file
diff --git a/expansions/info/chatslist.name b/expansions/info/chatslist.name
index dd94b35..cbffc8e 100644
--- a/expansions/info/chatslist.name
+++ b/expansions/info/chatslist.name
@@ -1,4 +1,4 @@
-{
- "RU": "чатлист",
- "UA": "чатлист"
+{
+ "RU": "чатлист",
+ "UA": "чатлист"
} \ No newline at end of file
diff --git a/expansions/info/inmuc.name b/expansions/info/inmuc.name
index 2339fc9..a7d0956 100644
--- a/expansions/info/inmuc.name
+++ b/expansions/info/inmuc.name
@@ -1,4 +1,4 @@
-{
- "RU": "инмук",
- "UA": "инмук"
+{
+ "RU": "инмук",
+ "UA": "инмук"
} \ No newline at end of file
diff --git a/expansions/info/online.name b/expansions/info/online.name
index 48b1207..304ee65 100644
--- a/expansions/info/online.name
+++ b/expansions/info/online.name
@@ -1,4 +1,4 @@
-{
- "RU": "онлайн",
- "UA": "онлайн"
+{
+ "RU": "онлайн",
+ "UA": "онлайн"
} \ No newline at end of file
diff --git a/expansions/info/search.name b/expansions/info/search.name
index cea0e45..d51f8e2 100644
--- a/expansions/info/search.name
+++ b/expansions/info/search.name
@@ -1,4 +1,4 @@
-{
- "RU": "где",
- "UA": "где"
+{
+ "RU": "где",
+ "UA": "где"
} \ No newline at end of file
diff --git a/expansions/info/visitors.name b/expansions/info/visitors.name
index 5a2a1ee..b5ed856 100644
--- a/expansions/info/visitors.name
+++ b/expansions/info/visitors.name
@@ -1,4 +1,4 @@
-{
- "RU": "ктобыл",
- "UA": "ктобыл"
+{
+ "RU": "ктобыл",
+ "UA": "ктобыл"
} \ No newline at end of file
diff --git a/expansions/interpreter/calc.name b/expansions/interpreter/calc.name
index f71e99f..3b8592a 100644
--- a/expansions/interpreter/calc.name
+++ b/expansions/interpreter/calc.name
@@ -1,4 +1,4 @@
-{
- "RU": "калк",
- "UA": "калк"
+{
+ "RU": "калк",
+ "UA": "калк"
} \ No newline at end of file
diff --git a/expansions/interpreter/eval.name b/expansions/interpreter/eval.name
index d649731..9288111 100644
--- a/expansions/interpreter/eval.name
+++ b/expansions/interpreter/eval.name
@@ -1,4 +1,4 @@
-{
- "RU": "eval",
- "UA": "eval"
+{
+ "RU": "eval",
+ "UA": "eval"
} \ No newline at end of file
diff --git a/expansions/interpreter/exec.name b/expansions/interpreter/exec.name
index 95b743f..f8a192b 100644
--- a/expansions/interpreter/exec.name
+++ b/expansions/interpreter/exec.name
@@ -1,4 +1,4 @@
-{
- "RU": "exec",
- "UA": "exec"
+{
+ "RU": "exec",
+ "UA": "exec"
} \ No newline at end of file
diff --git a/expansions/interpreter/sh.name b/expansions/interpreter/sh.name
index c4c20b3..f8183cc 100644
--- a/expansions/interpreter/sh.name
+++ b/expansions/interpreter/sh.name
@@ -1,4 +1,4 @@
-{
- "RU": "sh",
- "UA": "sh"
+{
+ "RU": "sh",
+ "UA": "sh"
} \ No newline at end of file
diff --git a/expansions/muc/admin.name b/expansions/muc/admin.name
index a9e0c00..61964a6 100644
--- a/expansions/muc/admin.name
+++ b/expansions/muc/admin.name
@@ -1,4 +1,4 @@
-{
- "RU": "админ",
- "UA": "админ"
+{
+ "RU": "админ",
+ "UA": "админ"
} \ No newline at end of file
diff --git a/expansions/muc/ban.name b/expansions/muc/ban.name
index 166c15d..9fea428 100644
--- a/expansions/muc/ban.name
+++ b/expansions/muc/ban.name
@@ -1,4 +1,4 @@
-{
- "RU": "бан",
- "UA": "бан"
+{
+ "RU": "бан",
+ "UA": "бан"
} \ No newline at end of file
diff --git a/expansions/muc/code.py b/expansions/muc/code.py
index 94d8f5f..78b6412 100644
--- a/expansions/muc/code.py
+++ b/expansions/muc/code.py
@@ -383,7 +383,7 @@ class expansion_temp(expansion):
def calcPerformance(self, desc):
cl = len(Chats.keys())
for x in xrange(60):
- time.sleep(0.2)
+ sleep(0.2)
if cl <= sum(desc.values()):
break
sl = sum(desc.values())
diff --git a/expansions/muc/fullban.name b/expansions/muc/fullban.name
index b326776..3f68d3b 100644
--- a/expansions/muc/fullban.name
+++ b/expansions/muc/fullban.name
@@ -1,4 +1,4 @@
-{
- "RU": "фулбан",
- "UA": "фулбан"
+{
+ "RU": "фулбан",
+ "UA": "фулбан"
} \ No newline at end of file
diff --git a/expansions/muc/fullunban.name b/expansions/muc/fullunban.name
index 6b00d2b..fbe744a 100644
--- a/expansions/muc/fullunban.name
+++ b/expansions/muc/fullunban.name
@@ -1,4 +1,4 @@
-{
- "RU": "фулунбан",
- "UA": "фулунбан"
+{
+ "RU": "фулунбан",
+ "UA": "фулунбан"
} \ No newline at end of file
diff --git a/expansions/muc/kick.name b/expansions/muc/kick.name
index 2b5ac7e..5389bf8 100644
--- a/expansions/muc/kick.name
+++ b/expansions/muc/kick.name
@@ -1,4 +1,4 @@
-{
- "RU": "кик",
- "UA": "кик"
+{
+ "RU": "кик",
+ "UA": "кик"
} \ No newline at end of file
diff --git a/expansions/muc/member.name b/expansions/muc/member.name
index 7cd3d94..40c820a 100644
--- a/expansions/muc/member.name
+++ b/expansions/muc/member.name
@@ -1,4 +1,4 @@
-{
- "RU": "мембер",
- "UA": "мембер"
+{
+ "RU": "мембер",
+ "UA": "мембер"
} \ No newline at end of file
diff --git a/expansions/muc/moder.name b/expansions/muc/moder.name
index d1689b6..c86e68e 100644
--- a/expansions/muc/moder.name
+++ b/expansions/muc/moder.name
@@ -1,4 +1,4 @@
-{
- "RU": "модер",
- "UA": "модер"
+{
+ "RU": "модер",
+ "UA": "модер"
} \ No newline at end of file
diff --git a/expansions/muc/none.name b/expansions/muc/none.name
index d0d27a8..e63357e 100644
--- a/expansions/muc/none.name
+++ b/expansions/muc/none.name
@@ -1,4 +1,4 @@
-{
- "RU": "никто",
- "UA": "никто"
+{
+ "RU": "никто",
+ "UA": "никто"
} \ No newline at end of file
diff --git a/expansions/muc/owner.name b/expansions/muc/owner.name
index b2bcf0e..21003fa 100644
--- a/expansions/muc/owner.name
+++ b/expansions/muc/owner.name
@@ -1,4 +1,4 @@
-{
- "RU": "овнер",
- "UA": "овнер"
+{
+ "RU": "овнер",
+ "UA": "овнер"
} \ No newline at end of file
diff --git a/expansions/muc/participant.name b/expansions/muc/participant.name
index 1be575d..25f4ddd 100644
--- a/expansions/muc/participant.name
+++ b/expansions/muc/participant.name
@@ -1,4 +1,4 @@
-{
- "RU": "участник",
- "UA": "участник"
+{
+ "RU": "участник",
+ "UA": "участник"
} \ No newline at end of file
diff --git a/expansions/muc/subject.name b/expansions/muc/subject.name
index ea798ed..1854afb 100644
--- a/expansions/muc/subject.name
+++ b/expansions/muc/subject.name
@@ -1,4 +1,4 @@
-{
- "RU": "топик",
- "UA": "топик"
+{
+ "RU": "топик",
+ "UA": "топик"
} \ No newline at end of file
diff --git a/expansions/muc/visitor.name b/expansions/muc/visitor.name
index 55fe6f0..13e0333 100644
--- a/expansions/muc/visitor.name
+++ b/expansions/muc/visitor.name
@@ -1,4 +1,4 @@
-{
- "RU": "визитор",
- "UA": "визитор"
+{
+ "RU": "визитор",
+ "UA": "визитор"
} \ No newline at end of file
diff --git a/expansions/new_year/new_year.name b/expansions/new_year/new_year.name
index 3fbf35d..9da2e2f 100644
--- a/expansions/new_year/new_year.name
+++ b/expansions/new_year/new_year.name
@@ -1,4 +1,4 @@
-{
- "RU": "нг",
- "UA": "нг"
+{
+ "RU": "нг",
+ "UA": "нг"
} \ No newline at end of file
diff --git a/expansions/note/note.name b/expansions/note/note.name
index b11e2ef..7fa34d2 100644
--- a/expansions/note/note.name
+++ b/expansions/note/note.name
@@ -1,4 +1,4 @@
-{
- "RU": "блокнот",
- "UA": "блокнот"
+{
+ "RU": "блокнот",
+ "UA": "блокнот"
} \ No newline at end of file
diff --git a/expansions/roster_control/roster.name b/expansions/roster_control/roster.name
index a400156..8af286d 100644
--- a/expansions/roster_control/roster.name
+++ b/expansions/roster_control/roster.name
@@ -1,4 +1,4 @@
-{
- "RU": "ростер",
- "UA": "ростер"
+{
+ "RU": "ростер",
+ "UA": "ростер"
} \ No newline at end of file
diff --git a/expansions/roster_control/roster2.name b/expansions/roster_control/roster2.name
index 3dcd2d9..b7c8586 100644
--- a/expansions/roster_control/roster2.name
+++ b/expansions/roster_control/roster2.name
@@ -1,4 +1,4 @@
-{
- "RU": "ростер*",
- "UA": "ростер*"
+{
+ "RU": "ростер*",
+ "UA": "ростер*"
} \ No newline at end of file
diff --git a/expansions/sconf_attrs/botjid.name b/expansions/sconf_attrs/botjid.name
index fe583b0..6d9c7aa 100644
--- a/expansions/sconf_attrs/botjid.name
+++ b/expansions/sconf_attrs/botjid.name
@@ -1,4 +1,4 @@
-{
- "RU": "ботжид",
- "UA": "ботжид"
+{
+ "RU": "ботжид",
+ "UA": "ботжид"
} \ No newline at end of file
diff --git a/expansions/sconf_attrs/botnick.name b/expansions/sconf_attrs/botnick.name
index aa0b24e..7f1e165 100644
--- a/expansions/sconf_attrs/botnick.name
+++ b/expansions/sconf_attrs/botnick.name
@@ -1,4 +1,4 @@
-{
- "RU": "ботник",
- "UA": "ботник"
+{
+ "RU": "ботник",
+ "UA": "ботник"
} \ No newline at end of file
diff --git a/expansions/sconf_attrs/botstatus.name b/expansions/sconf_attrs/botstatus.name
index 419bebb..c663e8c 100644
--- a/expansions/sconf_attrs/botstatus.name
+++ b/expansions/sconf_attrs/botstatus.name
@@ -1,4 +1,4 @@
-{
- "RU": "ботстатус",
- "UA": "ботстатус"
+{
+ "RU": "ботстатус",
+ "UA": "ботстатус"
} \ No newline at end of file
diff --git a/expansions/sconf_attrs/code.py b/expansions/sconf_attrs/code.py
index d36b87d..163a2d0 100644
--- a/expansions/sconf_attrs/code.py
+++ b/expansions/sconf_attrs/code.py
@@ -27,7 +27,7 @@ class expansion_temp(expansion):
Chats[conf].leave(self.AnsBase[3])
Chats[conf].disp = disp_
Chats[conf].save()
- time.sleep(0.6)
+ sleep(0.6)
Chats[conf].join()
if conf == source[1]:
disp = disp_
diff --git a/expansions/sconf_attrs/password.name b/expansions/sconf_attrs/password.name
index 0183ae2..fa11922 100644
--- a/expansions/sconf_attrs/password.name
+++ b/expansions/sconf_attrs/password.name
@@ -1,4 +1,4 @@
-{
- "RU": "пароль",
- "UA": "пароль"
+{
+ "RU": "пароль",
+ "UA": "пароль"
} \ No newline at end of file
diff --git a/expansions/sconf_attrs/prefix.name b/expansions/sconf_attrs/prefix.name
index 2706f27..8d16ee4 100644
--- a/expansions/sconf_attrs/prefix.name
+++ b/expansions/sconf_attrs/prefix.name
@@ -1,4 +1,4 @@
-{
- "RU": "префикс",
- "UA": "префикс"
+{
+ "RU": "префикс",
+ "UA": "префикс"
} \ No newline at end of file
diff --git a/expansions/session_stat/botup.en b/expansions/session_stats/botup.en
index 46ee56d..46ee56d 100644
--- a/expansions/session_stat/botup.en
+++ b/expansions/session_stats/botup.en
diff --git a/expansions/session_stat/botup.name b/expansions/session_stats/botup.name
index 6ce7452..daeab5b 100644
--- a/expansions/session_stat/botup.name
+++ b/expansions/session_stats/botup.name
@@ -1,4 +1,4 @@
-{
- "RU": "ботап",
- "UA": "ботап"
+{
+ "RU": "ботап",
+ "UA": "ботап"
} \ No newline at end of file
diff --git a/expansions/session_stat/botup.ru b/expansions/session_stats/botup.ru
index 3a061c5..3a061c5 100644
--- a/expansions/session_stat/botup.ru
+++ b/expansions/session_stats/botup.ru
diff --git a/expansions/session_stat/code.py b/expansions/session_stats/code.py
index 0406592..c7d4c4d 100644
--- a/expansions/session_stat/code.py
+++ b/expansions/session_stats/code.py
@@ -1,9 +1,9 @@
# coding: utf-8
# BlackSmith mark.2
-exp_name = "session_stat" # /code.py v.x5
-# Id: 10~3b
-# Code © (2010-2011) by WitcherGeralt [alkorgun@gmail.com]
+exp_name = "session_stats" # /code.py v.x6
+# Id: 10~4b
+# Code © (2010-2012) by WitcherGeralt [alkorgun@gmail.com]
expansion_register(exp_name)
@@ -21,7 +21,7 @@ class expansion_temp(expansion):
exc = VarCache["errors"][Number]
if oSlist[0]:
exc = exc.decode("cp1251")
- exc = "%s" % (exc)
+ exc = str(exc)
if ltype == Types[1]:
Answer(AnsBase[11], ltype, source, disp)
Message(source[0], exc, disp)
@@ -69,31 +69,25 @@ class expansion_temp(expansion):
answer += self.AnsBase[14] % str(round(float(Number) / 1024, 3))
Answer(answer, ltype, source, disp)
- def command_stat(self, ltype, source, body, disp):
+ def command_stats(self, ltype, source, body, disp):
if body:
- x = body.lower()
- if x in Cmds.keys():
- answer = self.AnsBase[18] % (x, Cmds[x].numb._str(), len(Cmds[x].desc))
+ cmd = body.lower()
+ if Cmds.has_key(cmd):
+ answer = self.AnsBase[18] % (cmd, Cmds[cmd].numb._str(), len(Cmds[cmd].desc))
else:
answer = AnsBase[6]
else:
- list = []
- for x in Cmds.values():
- x_len = x.numb._int()
- if x_len:
- list.append((x_len, len(x.desc), x.name))
- list.sort()
- list.reverse()
- answer, Numb = self.AnsBase[19], itypes.Number()
- for x, y, z in list:
- answer += "\n%s. %s - %d (%d)" % (Numb.plus(), z, x, y)
- if Numb._int() >= 20:
- break
+ ls = []
+ for cmd in Cmds.values():
+ used = cmd.numb._int()
+ if used:
+ ls.append((used, len(cmd.desc), cmd.name))
+ answer = self.AnsBase[19] + str.join(chr(10), ["%s. %s - %d (%d)" % (numb, name, used, desc) for numb, (used, desc, name) in enumerate(sorted(ls, reverse = True), 1)])
Answer(answer, ltype, source, disp)
commands = (
(command_exc_info, "excinfo", 8,),
(command_botup, "botup", 1,),
(command_session, "stat", 1,),
- (command_stat, "comstat", 1,)
+ (command_stats, "comstat", 1,)
)
diff --git a/expansions/session_stat/comstat.en b/expansions/session_stats/comstat.en
index 5ca99d2..5ca99d2 100644
--- a/expansions/session_stat/comstat.en
+++ b/expansions/session_stats/comstat.en
diff --git a/expansions/session_stat/comstat.name b/expansions/session_stats/comstat.name
index 7c6c0ca..0821687 100644
--- a/expansions/session_stat/comstat.name
+++ b/expansions/session_stats/comstat.name
@@ -1,4 +1,4 @@
-{
- "RU": "комстат",
- "UA": "комстат"
+{
+ "RU": "комстат",
+ "UA": "комстат"
} \ No newline at end of file
diff --git a/expansions/session_stat/comstat.ru b/expansions/session_stats/comstat.ru
index a7b5fc4..a7b5fc4 100644
--- a/expansions/session_stat/comstat.ru
+++ b/expansions/session_stats/comstat.ru
diff --git a/expansions/session_stat/excinfo.en b/expansions/session_stats/excinfo.en
index 54a9a04..54a9a04 100644
--- a/expansions/session_stat/excinfo.en
+++ b/expansions/session_stats/excinfo.en
diff --git a/expansions/session_stat/excinfo.name b/expansions/session_stats/excinfo.name
index 60f985a..39a38a1 100644
--- a/expansions/session_stat/excinfo.name
+++ b/expansions/session_stats/excinfo.name
@@ -1,4 +1,4 @@
-{
- "RU": "ошибка",
- "UA": "ошибка"
+{
+ "RU": "ошибка",
+ "UA": "ошибка"
} \ No newline at end of file
diff --git a/expansions/session_stat/excinfo.ru b/expansions/session_stats/excinfo.ru
index 1bcb4c4..1bcb4c4 100644
--- a/expansions/session_stat/excinfo.ru
+++ b/expansions/session_stats/excinfo.ru
diff --git a/expansions/session_stat/insc.py b/expansions/session_stats/insc.py
index 5d33f8c..1825137 100644
--- a/expansions/session_stat/insc.py
+++ b/expansions/session_stats/insc.py
@@ -21,7 +21,7 @@ if DefLANG in ("RU", "UA"):
"\nПоследняя сессия: %s.\nВсего %s перезагрузок:\n%s.", # 16
" - Работаю без перезагрузок!", # 17
"\nСтатистика по команде '%s':\nВсего использовали - %s раз (%d юзеров).", # 18
- "\n[№][Команда][Использований][Юзеров]", # 19
+ "\n[№][Команда][Использований][Юзеров]\n", # 19
"Невозможно отправить ошибку, смотри к крешлогах.", # 20
"Ошибки №%s не существует!", # 21
"Всего произошло %d ошибок." # 22
@@ -47,7 +47,7 @@ else:
"\nThe last working set: %s.\nReloads (%s):\n%s.", # 16
" - Working without restarts!", # 17
"\nCommand '%s' usage statistics:\nTotal used - %s times (%d users).", # 18
- "\n[#][Command][Used][Users used]", # 19
+ "\n[#][Command][Used][Users]\n", # 19
"Unable to send error, look for crash logs.", # 20
"Exception #%s isn't exists!", # 21
"Total %d exceptions happened." # 22
diff --git a/expansions/session_stat/stat.en b/expansions/session_stats/stat.en
index 1617656..1617656 100644
--- a/expansions/session_stat/stat.en
+++ b/expansions/session_stats/stat.en
diff --git a/expansions/session_stat/stat.name b/expansions/session_stats/stat.name
index d410933..2bb8c1b 100644
--- a/expansions/session_stat/stat.name
+++ b/expansions/session_stats/stat.name
@@ -1,4 +1,4 @@
-{
- "RU": "стат",
- "UA": "стат"
+{
+ "RU": "стат",
+ "UA": "стат"
} \ No newline at end of file
diff --git a/expansions/session_stat/stat.ru b/expansions/session_stats/stat.ru
index 228a189..228a189 100644
--- a/expansions/session_stat/stat.ru
+++ b/expansions/session_stats/stat.ru
diff --git a/expansions/sheriff/code.py b/expansions/sheriff/code.py
index a807f24..09cf355 100644
--- a/expansions/sheriff/code.py
+++ b/expansions/sheriff/code.py
@@ -331,7 +331,7 @@ class expansion_temp(expansion):
if self.Federal_Jail[conf].has_key(sUser.source):
del self.Federal_Jail[conf][sUser.source]
for source_ in list:
- Chats[conf].none(source_); time.sleep(0.4)
+ Chats[conf].none(source_); sleep(0.4)
def get_server(self, source, state = 0):
At = chr(64)
@@ -423,7 +423,7 @@ class expansion_temp(expansion):
if not self.Questions:
for qu in self.AnsBase[19].splitlines():
qu, an = qu.split(chr(124), 1)
- self.Questions.append((qu.strip(), an.strip().lower()))
+ self.Questions.append((qu.strip(), (an.strip()).lower()))
qu, an = choice(self.Questions)
prisoner.vakey = an
Message("%s/%s" % (conf, nick), self.AnsBase[18] % (qu), disp)
diff --git a/expansions/sheriff/order.name b/expansions/sheriff/order.name
index 132ccd9..d8a97c0 100644
--- a/expansions/sheriff/order.name
+++ b/expansions/sheriff/order.name
@@ -1,4 +1,4 @@
-{
- "RU": "ордер",
- "UA": "ордер"
+{
+ "RU": "ордер",
+ "UA": "ордер"
} \ No newline at end of file
diff --git a/expansions/talkers/code.py b/expansions/talkers/code.py
index 3657f4d..0663575 100644
--- a/expansions/talkers/code.py
+++ b/expansions/talkers/code.py
@@ -75,7 +75,7 @@ class expansion_temp(expansion):
elif a1 in ("global", "глобальный".decode("utf-8")):
a2 = body[((body.lower()).find(a1) + len(a1)):].strip()
- def get_talker_stat(source_):
+ def get_talker_stats(source_):
x, y = 0, 0
for conf in Chats.keys():
filename = cefile(chat_file(conf, self.TalkersFile))
@@ -95,7 +95,7 @@ class expansion_temp(expansion):
if a2 in ("mine", "мой".decode("utf-8")):
source_ = get_source(source[1], source[2])
if source_:
- answer = get_talker_stat(source_)
+ answer = get_talker_stats(source_)
else:
answer = self.AnsBase[1]
else:
@@ -106,7 +106,7 @@ class expansion_temp(expansion):
if not isSource(source_):
source_ = None
if source_:
- answer = get_talker_stat(source_)
+ answer = get_talker_stats(source_)
else:
Glob_dbs = {}
for conf in Chats.keys():
@@ -139,7 +139,7 @@ class expansion_temp(expansion):
elif a1 in ("local", "локальный".decode("utf-8")):
a2 = body[((body.lower()).find(a1) + len(a1)):].strip()
- def get_talker_stat(source_, conf):
+ def get_talker_stats(source_, conf):
filename = cefile(chat_file(conf, self.TalkersFile))
with self.TalkersDesc[conf]:
with database(filename) as db:
@@ -154,7 +154,7 @@ class expansion_temp(expansion):
if a2 in ("mine", "мой".decode("utf-8")):
source_ = get_source(source[1], source[2])
if source_:
- answer = get_talker_stat(source_, source[1])
+ answer = get_talker_stats(source_, source[1])
else:
answer = self.AnsBase[1]
else:
@@ -165,7 +165,7 @@ class expansion_temp(expansion):
if not isSource(source_):
source_ = None
if source_:
- answer = get_talker_stat(source_, source[1])
+ answer = get_talker_stats(source_, source[1])
else:
filename = cefile(chat_file(source[1], self.TalkersFile))
with self.TalkersDesc[source[1]]:
diff --git a/expansions/talkers/talkers.name b/expansions/talkers/talkers.name
index 669e832..e2a505a 100644
--- a/expansions/talkers/talkers.name
+++ b/expansions/talkers/talkers.name
@@ -1,4 +1,4 @@
-{
- "RU": "трёп",
- "UA": "трёп"
+{
+ "RU": "трёп",
+ "UA": "трёп"
} \ No newline at end of file
diff --git a/expansions/turn/turn.name b/expansions/turn/turn.name
index b79345f..355918b 100644
--- a/expansions/turn/turn.name
+++ b/expansions/turn/turn.name
@@ -1,4 +1,4 @@
-{
- "RU": "турн",
- "UA": "турн"
+{
+ "RU": "турн",
+ "UA": "турн"
} \ No newline at end of file
diff --git a/expansions/user_stats/code.py b/expansions/user_stats/code.py
index 3b3f1c6..bdd3364 100644
--- a/expansions/user_stats/code.py
+++ b/expansions/user_stats/code.py
@@ -1,9 +1,9 @@
# coding: utf-8
# BlackSmith mark.2
-exp_name = "user_stats" # /code.py v.x5
-# Id: 17~4b
-# Code © (2010-2011) by WitcherGeralt [alkorgun@gmail.com]
+exp_name = "user_stats" # /code.py v.x6
+# Id: 17~5b
+# Code © (2010-2012) by WitcherGeralt [alkorgun@gmail.com]
expansion_register(exp_name)
@@ -12,9 +12,9 @@ class expansion_temp(expansion):
def __init__(self, name):
expansion.__init__(self, name)
- UstatFile = "jstat.db"
+ UstatsFile = "jstat.db"
- UstatDesc = {}
+ UstatsDesc = {}
def command_user_stats(self, ltype, source, body, disp):
if Chats.has_key(source[1]):
@@ -22,8 +22,8 @@ class expansion_temp(expansion):
body = get_source(source[1], source[2])
elif Chats[source[1]].isHere(body):
body = get_source(source[1], body)
- filename = cefile(chat_file(source[1], self.UstatFile))
- with self.UstatDesc[source[1]]:
+ filename = cefile(chat_file(source[1], self.UstatsFile))
+ with self.UstatsDesc[source[1]]:
with database(filename) as db:
db("select * from stat where jid=?", (body,))
db_desc = db.fetchone()
@@ -56,8 +56,8 @@ class expansion_temp(expansion):
def calc_stat_04eh(self, conf, nick, instance, role, stanza, disp):
if instance and nick != get_self_nick(conf):
- date, filename = strTime(local = False), cefile(chat_file(conf, self.UstatFile))
- with self.UstatDesc[conf]:
+ date, filename = strTime(local = False), cefile(chat_file(conf, self.UstatsFile))
+ with self.UstatsDesc[conf]:
with database(filename) as db:
db("select * from stat where jid=?", (instance,))
db_desc = db.fetchone()
@@ -82,8 +82,8 @@ class expansion_temp(expansion):
sbody = "banned:(%s)" % (sbody)
elif scode == sCodes[2]:
sbody = "kicked:(%s)" % (sbody)
- date, filename = strTime(local = False), cefile(chat_file(conf, self.UstatFile))
- with self.UstatDesc[conf]:
+ date, filename = strTime(local = False), cefile(chat_file(conf, self.UstatsFile))
+ with self.UstatsDesc[conf]:
with database(filename) as db:
db("select * from stat where jid=?", (source_,))
db_desc = db.fetchone()
@@ -95,8 +95,8 @@ class expansion_temp(expansion):
if nick != get_self_nick(conf):
source_ = get_source(conf, nick)
if source_:
- filename = cefile(chat_file(conf, self.UstatFile))
- with self.UstatDesc[conf]:
+ filename = cefile(chat_file(conf, self.UstatsFile))
+ with self.UstatsDesc[conf]:
with database(filename) as db:
db("select * from stat where jid=?", (source_,))
db_desc = db.fetchone()
@@ -108,8 +108,8 @@ class expansion_temp(expansion):
if nick != get_self_nick(conf):
source_ = get_source(conf, nick)
if source_:
- filename = cefile(chat_file(conf, self.UstatFile))
- with self.UstatDesc[conf]:
+ filename = cefile(chat_file(conf, self.UstatsFile))
+ with self.UstatsDesc[conf]:
with database(filename) as db:
db("select * from stat where jid=?", (source_,))
db_desc = db.fetchone()
@@ -120,15 +120,15 @@ class expansion_temp(expansion):
db.commit()
def init_stat_base(self, conf):
- filename = cefile(chat_file(conf, self.UstatFile))
+ filename = cefile(chat_file(conf, self.UstatsFile))
if not os.path.isfile(filename):
with database(filename) as db:
db("create table stat (jid text, arole text, joined text, joins integer, seen text, leave text, nicks text)")
db.commit()
- self.UstatDesc[conf] = iThr.Semaphore()
+ self.UstatsDesc[conf] = iThr.Semaphore()
def edit_stat_desc(self, conf):
- del self.UstatDesc[conf]
+ del self.UstatsDesc[conf]
commands = (
(command_user_stats, "userstat", 2,),
diff --git a/expansions/user_stats/here.name b/expansions/user_stats/here.name
index bdb441a..996ed0f 100644
--- a/expansions/user_stats/here.name
+++ b/expansions/user_stats/here.name
@@ -1,4 +1,4 @@
-{
- "RU": "пребывание",
- "UA": "пребывание"
+{
+ "RU": "пребывание",
+ "UA": "пребывание"
} \ No newline at end of file
diff --git a/expansions/user_stats/userstat.name b/expansions/user_stats/userstat.name
index 02f3e1e..31d283d 100644
--- a/expansions/user_stats/userstat.name
+++ b/expansions/user_stats/userstat.name
@@ -1,4 +1,4 @@
-{
- "RU": "юзерстат",
- "UA": "юзерстат"
+{
+ "RU": "юзерстат",
+ "UA": "юзерстат"
} \ No newline at end of file
diff --git a/expansions/wtf/code.py b/expansions/wtf/code.py
index be16ce7..da3cf1d 100644
--- a/expansions/wtf/code.py
+++ b/expansions/wtf/code.py
@@ -1,8 +1,8 @@
# coding: utf-8
# BlackSmith mark.2
-exp_name = "wtf" # /code.py v.x1
-# Id: 28~1b
+exp_name = "wtf" # /code.py v.x2
+# Id: 28~2b
# Code © (2012) by WitcherGeralt [alkorgun@gmail.com]
expansion_register(exp_name)
@@ -139,22 +139,25 @@ class expansion_temp(expansion):
answer = AnsBase[2]
else:
answer = AnsBase[10]
- elif self.sep in body:
- ls = body.split(self.sep, 1)
- name, data = ls
- name, data = (name.rstrip()).lower(), data.lstrip()
- if name and len(name) <= 64:
- with database(self.Base) as db:
- db("select date from wtf where name=?", (name,))
- date = db.fetchone()
- if date and data:
- answer = self.AnsBase[9] % (name)
+ elif Chats.has_key(source[1]):
+ if self.sep in body:
+ ls = body.split(self.sep, 1)
+ name, data = ls
+ name, data = (name.rstrip()).lower(), data.lstrip()
+ if name and len(name) <= 64:
+ with database(self.Base) as db:
+ db("select date from wtf where name=?", (name,))
+ date = db.fetchone()
+ if date and data:
+ answer = self.AnsBase[9] % (name)
+ else:
+ answer = self.addDef(cefile(chat_file(source[1], self.ChatBase)), name, data, source[2])
else:
- answer = self.addDef(cefile(chat_file(source[1], self.ChatBase)), name, data, source[2])
+ answer = AnsBase[2]
else:
answer = AnsBase[2]
else:
- answer = AnsBase[2]
+ answer = self.AnsBase[10]
else:
answer = AnsBase[1]
Answer(answer, ltype, source, disp)
diff --git a/expansions/wtf/def.name b/expansions/wtf/def.name
index 0178896..e0b69ae 100644
--- a/expansions/wtf/def.name
+++ b/expansions/wtf/def.name
@@ -1,4 +1,4 @@
-{
- "RU": "задать",
- "UA": "задать"
+{
+ "RU": "задать",
+ "UA": "задать"
} \ No newline at end of file
diff --git a/expansions/wtf/insc.py b/expansions/wtf/insc.py
index d698c63..fa20ac0 100644
--- a/expansions/wtf/insc.py
+++ b/expansions/wtf/insc.py
@@ -12,6 +12,7 @@ if DefLANG in ("RU", "UA"):
"Всего %d определений в глобальной базе.", # 7
"Всего %d определений в базе %s.", # 8
"Определение «%s» уже есть в глобальной базе.", # 9
+ "Не существует локальной базы для ростера.", # 10
"\->\n" # -1
)])
else:
@@ -26,5 +27,6 @@ else:
"There are %d definitions in the global base.", # 7
"There are %d definitions in the base of %s.", # 8
"'%s' is already in the global base.", # 9
+ "There is no local base for the roster.", # 10
"\->\n" # -1
) \ No newline at end of file
diff --git a/expansions/wtf/wtf.name b/expansions/wtf/wtf.name
index 8541d3f..60e4461 100644
--- a/expansions/wtf/wtf.name
+++ b/expansions/wtf/wtf.name
@@ -1,4 +1,4 @@
-{
- "RU": "показать",
- "UA": "показать"
+{
+ "RU": "показать",
+ "UA": "показать"
} \ No newline at end of file