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

github.com/mrDoctorWho/vk4xmpp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormrDoctorWho <mrdoctorwho@gmail.com>2013-12-02 16:16:37 +0400
committermrDoctorWho <mrdoctorwho@gmail.com>2013-12-02 16:16:37 +0400
commit2e8c93bd812cd6faffc55a8f6e55156f351bd081 (patch)
treef641f6fd22d954a46ef4448ea8d311147f4ccb50
parentd50dd5214c585c65265887cc1f95986f533885ad (diff)
add options for change storage files pidFile.txt and Config.txt. Removed unused argument "force" for method()
removed "User not allowed to perform this action"
-rw-r--r--gateway.py18
-rw-r--r--handlers/IQ.py2
-rw-r--r--handlers/Presence.py5
-rw-r--r--locales/locale.pl2
-rw-r--r--locales/locale.ru2
5 files changed, 20 insertions, 9 deletions
diff --git a/gateway.py b/gateway.py
index 924c5b0..5b9a2c0 100644
--- a/gateway.py
+++ b/gateway.py
@@ -69,8 +69,13 @@ DEBUG_XMPPPY = False
THREAD_STACK_SIZE = 0
MAXIMUM_FORWARD_DEPTH = 5
-pidFile = "pidFile.txt"
-Config = "Config.txt"
+from optparse import OptionParser
+oParser = OptionParser(usage = "%prog [options]")
+oParser.add_option("-p", "--pid", dest = "pidFile", help = "address used for pid file storage", metavar = "pidFile", default = "pidFile.txt")
+oParser.add_option("-c", "--config", dest = "Config", help = "same as -p (--pid) but for config file", metavar = "Config", default = "Config.txt")
+(options, args) = oParser.parse_args()
+pidFile, Config = options.pidFile, options.Config
+
PhotoSize = "photo_100"
DefLang = "ru"
evalJID = ""
@@ -201,16 +206,17 @@ class VKLogin(object):
return False
return True
- def method(self, method, args = {}, force = False):
+ def method(self, method, args = {}):
result = {}
- if not self.engine.captcha and self.Online or force:
+ if not self.engine.captcha and self.Online:
try:
result = self.engine.method(method, args)
except api.CaptchaNeeded:
logger.error("VKLogin: running captcha challenge for %s" % self.jidFrom)
self.captchaChallenge()
except api.NotAllowed:
- msgSend(Component, self.jidFrom, _("You're not allowed to perform this action."), vk2xmpp(args.get("user_id", TransportID)))
+ if self.engine.lastMethod[0] == "messages.send":
+ msgSend(Component, self.jidFrom, _("You're not allowed to perform this action."), vk2xmpp(args.get("user_id", TransportID)))
except api.VkApiError as e:
if e.message == "User authorization failed: user revoke access for this token.":
try:
@@ -662,7 +668,7 @@ def main():
Print("\n#-# Finished.")
def exit(signal = None, frame = None): # LETS BURN CPU AT LAST TIME!
- status = "Shutting down by %s" % ("SIGTERM" if signal else "KeyboardInterrupt")
+ status = "Shutting down by %s" % ("SIGTERM" if signal == 15 else "SIGINT")
Print("#! %s" % status, False)
for Class in TransportsList:
Class.sendOutPresence(Class.jidFrom, status)
diff --git a/handlers/IQ.py b/handlers/IQ.py
index f0353f6..4fac364 100644
--- a/handlers/IQ.py
+++ b/handlers/IQ.py
@@ -158,7 +158,7 @@ def iqRegisterHandler(cl, iq):
Class = Transport[jidFromStr]
Class.deleteUser(True)
result.setPayload([], add = 0)
- WatcherMsg(_("User remove registration: %s") % jidFromStr)
+ WatcherMsg(_("User removed registration: %s") % jidFromStr)
else:
result = iqBuildError(iq, 0, _("Feature not implemented."))
Sender(cl, result)
diff --git a/handlers/Presence.py b/handlers/Presence.py
index 9cdf13b..bbd552e 100644
--- a/handlers/Presence.py
+++ b/handlers/Presence.py
@@ -46,6 +46,11 @@ def prsHandler(cl, prs):
if id in Class.friends:
if Class.friends[id]["online"]:
Sender(cl, xmpp.Presence(jidFrom, frm = jidTo))
+ elif pType == "unsubscribe":
+ if jidFromStr in Transport:
+ Class.deleteUser(True)
+ WatcherMsg(_("User removed registration: %s") % jidFromStr)
+
if jidToStr == TransportID:
Class.lastStatus = pType
diff --git a/locales/locale.pl b/locales/locale.pl
index e5c3640..a28eb4d 100644
--- a/locales/locale.pl
+++ b/locales/locale.pl
@@ -18,7 +18,7 @@ Auth failed! If this error repeated, please register again. This incident will b
\LAttachments:=\LZałączniki:
Enter shown text=Wprowadź wyświetlany tekst
New user registered: %s=Zarejestrowany nowy użytkownik: %s
-User remove registration: %s=Użytkownik usunął rejestrację: %s
+User removed registration: %s=Użytkownik usunął rejestrację: %s
Type data in fields=Wprowadź dane w pola
Autorization page=Strona autoryzacji
If you won't get access-token automatically, please, follow authorization link and authorize app,\Land then paste url to password field.=Jeśli jednak nie chcesz otrzymać access-token automatycznie, to kliknij w link z pola, autoryzuj aplikację,\Lа następnie wprowadź otryzmany URL z paska adresu pryeglądarki w ostatnie pole zamiast hasła.
diff --git a/locales/locale.ru b/locales/locale.ru
index fea712b..caa4f80 100644
--- a/locales/locale.ru
+++ b/locales/locale.ru
@@ -18,7 +18,7 @@ Auth failed! If this error repeated, please register again. This incident will b
\LAttachments:=\LВложения:
Enter shown text=Введите показанный текст
New user registered: %s=Зарегистрирован новый пользователь: %s
-User remove registration: %s=Пользователь удалил регистрацию: %s
+User removed registration: %s=Пользователь удалил регистрацию: %s
Type data in fields=Введите данные в поля
Autorization page=Страница авторизации
If you won't get access-token automatically, please, follow authorization link and authorize app,\Land then paste url to password field.=Если же вы не хотите получить access-token автоматически, то пройдите по ссылке из поля, авторизируйте приложение,\Lа затем введите полученный URL из адресной строки браузера в последнее поле вместо пароля.