diff options
author | mrDoctorWho <mrdoctorwho@gmail.com> | 2015-05-01 21:04:44 +0300 |
---|---|---|
committer | mrDoctorWho <mrdoctorwho@gmail.com> | 2015-05-01 21:04:44 +0300 |
commit | 83841d3381b66767ec29b56cd46a0979b3e52e83 (patch) | |
tree | 87e64362698b13cbde09ea97b25ab048063f301b | |
parent | db435ae3df3111b103b65f1934d39320199004f8 (diff) |
Update config & add READMEs for extensions.
-rw-r--r-- | Config_example.txt | 85 | ||||
-rw-r--r-- | extensions.README.md | 5 | ||||
-rw-r--r-- | extensions/alive_keeper.README.md | 10 | ||||
-rw-r--r-- | extensions/alive_keeper.py | 4 | ||||
-rw-r--r-- | extensions/avatar_hash.README.md | 10 | ||||
-rw-r--r-- | extensions/groupchats.README.md | 26 | ||||
-rw-r--r-- | extensions/interpreter.py | 14 | ||||
-rw-r--r-- | extensions/user_activity.README.md | 22 |
8 files changed, 124 insertions, 52 deletions
diff --git a/Config_example.txt b/Config_example.txt index ab3277e..1186a52 100644 --- a/Config_example.txt +++ b/Config_example.txt @@ -1,28 +1,27 @@ # coding: utf-8 -# Connection hostname. -# For Prosody: "vk.example.com". +# Connection host. +# For Prosody/Ejabberd: "vk.example.com". +# For Openfire (for new versions): just subdomain ("vk" for vk.example.com). Host = "localhost" # Connection server (usually equals hostname). -# For Prosody: "localhost". +# If your transport runs on the same server as the jabber-server +# Then it's just "localhost". Server = "localhost" # Connection port (as set in Jabber server config). # Default value for Prosody is 5347. Port = 5347 -# Transport ID (for all instances of vk4xmpp). +# Transport ID (the ID which the transport will send stanzas from). TransportID = "vk.example.com" # Connection password. Password = "secret" # Language (ru/en/pl). -DefLang = "ru" - -# Photo size (photo_50, photo_100, photo_200_orig). -PhotoSize = "photo_100" +DefLang = "en" # White list. Put servers here that should be allowed access to the # transport, e.g., ['yourserver1.tld','yourserver2.tld']. @@ -34,6 +33,10 @@ WhiteList = [] # Leave it blank to disable notifications. WatcherList = [] +# List of admin jids (JID for "!eval" command and admin-features in adhoc). +# Example: ["mrdoctorwho@example.com", "lindsey@somehost.com"] +ADMIN_JIDS = [] + # Additional description. It will be shown after "about" text in transport's vCard. AdditionalAbout = "" @@ -41,73 +44,73 @@ AdditionalAbout = "" # server's MUC. E.g., conference.example.com. ConferenceServer = "" -# Publish this intstance information in public transport list at +# Photo size (photo_50, photo_100, photo_200_orig). +# Affects transport stability & performance +PhotoSize = "photo_100" + +# Publish this intstance information in the public transport list at # http://xmppserv.ru.ru/xmpp-monitor. allowBePublic = True # User limit. How many users can be registered on your server? -# Set to 0 for "unlimited". +# Set to 0 for unlimited. USER_LIMIT = 0 # URL which will be used in registration form. See the example in js/vk4xmpp.html or in http://simpleapps.ru/vk4xmpp.html (if the site is still alive in your time) # URL MUST have "%d" somewhere, it's used for access definition. Since 01.08.2014 any plugin can modify the access, so it will be defined in the url. URL_ACCEPT_APP = "http://jabberon.ru/vk4xmpp.html#%d" +# Image that will be used if the transport can't recieve image from VK. +URL_VCARD_NO_IMAGE = "https://raw.githubusercontent.com/mrDoctorWho/vk4xmpp/master/vk4xmpp.png" + #! Danger zone. #! Change the settings below ONLY IF YOU KNOW WHAT ARE YOU DOING! DEFAULT VALUES ARE RECOMMENDED! -## Thread stack size (WARNING: THIS MAY CAUSE TRANSPORT CRASH WITH SEGMENTATION FAULT ERROR). -## You may need to tune it to optimize memory consuming. -## Minimum value is 32768 bytes (32kb). +# You were warned. +# Thread stack size (WARNING: THIS MAY CAUSE TRANSPORT CRASH WITH SEGMENTATION FAULT ERROR). +# You may need to tune it to optimize memory consuming. +# Minimum value is 32768 bytes (32kb). THREAD_STACK_SIZE = 0 -## Maximum forwarded messages depth. -MAXIMUM_FORWARD_DEPTH = 20 - -## Image that will be used if the transport can't recieve image from VK. -URL_VCARD_NO_IMAGE = "https://raw.githubusercontent.com/mrDoctorWho/vk4xmpp/master/vk4xmpp.png" - -## Eval JID (JID for "!eval" command and admin-features in adhoc). -ADMIN_JIDS = [] - -## Debug xmpppy library. -DEBUG_XMPPPY = False - -## Database file (anything you like). +# Database file (anything you like). DatabaseFile = "vk4xmpp.db" -## File to store PID in. +# File to store PID in. pidFile = "vk4xmpp.pid" -## Log file. +# Log file. logFile = "vk4xmpp.log" -## Directory for crash logs storage. +# Directory where transport will write crash logs. crashDir = "crash" -## Log level (logging.INFO, logging.DEBUG, logging.ERROR, logging.CRITICAL). -LOG_LEVEL = logging.DEBUG - -## Directory for users settings. +# Directory for users settings. settingsDir = "settings" -## Stanza send interval (in seconds). +# Stanza send interval (in seconds). STANZA_SEND_INTERVAL = 0.03125 -## Debug longpoll queries. +# Debug xmpppy library. +DEBUG_XMPPPY = False + +# Debug longpoll queries. DEBUG_POLL = False -## Debug api requests. It should contain a list of the methods you like to debug. Set to "all" if you like to debug all the methods. +# Debug api requests. +# Put the list of the methods you like to debug. Set to "all" if you want to debug all the methods. DEBUG_API = [] -## VK4XMPP Monitor settings -## The server where the stats requests will come from +# Log level (logging.INFO, logging.DEBUG, logging.ERROR, logging.CRITICAL). +LOG_LEVEL = logging.DEBUG + +# VK4XMPP Monitor settings +# The server where the stats requests will come from VK4XMPP_MONITOR_SERVER = "anon.xmppserv.ru" -## The URL where transport should send POST requests with it's name -## See https://github.com/aawray/xmpp-monitor +# The URL where transport should send POST requests with it's name +# See https://github.com/aawray/xmpp-monitor for more information VK4XMPP_MONITOR_URL = "http://xmppserv.ru/xmpp-monitor/hosts.php" -## Posix +# THE FOLLOWING OPTIONS ARE FOR POSIX-LIKE SYSTEMS ONLY # Run as a specified user. Set to "username" to run as "username" instead of current user. # Bear in mind that transport must have permission to run as this user. RUN_AS = None
\ No newline at end of file diff --git a/extensions.README.md b/extensions.README.md new file mode 100644 index 0000000..fbd6dea --- /dev/null +++ b/extensions.README.md @@ -0,0 +1,5 @@ +Extensions +==== +Transport source contain extensions that may have their own configuration. + +Make sure you read all README files in the *extensions* directory. diff --git a/extensions/alive_keeper.README.md b/extensions/alive_keeper.README.md new file mode 100644 index 0000000..d5dbe6c --- /dev/null +++ b/extensions/alive_keeper.README.md @@ -0,0 +1,10 @@ +Installation +==== + +Add a field named ALIVE_KEEPER_ENABLED in the main config file and set it's value to True in order to enable the keeper. + +Example: + +```python +ALIVE_KEEPER_ENABLED = True +```
\ No newline at end of file diff --git a/extensions/alive_keeper.py b/extensions/alive_keeper.py index ed1d14e..9d064b1 100644 --- a/extensions/alive_keeper.py +++ b/extensions/alive_keeper.py @@ -1,8 +1,8 @@ # coding: utf-8 # Code © WitcherGeralt, 2012. # Originally coded for BlackSmith bot mark.2 -## Installation: -## Add a field named ALIVE_KEEPER_ENABLED in the main config file and set it's value to True in order to enable the keeper. +# Installation: +# Add a field named ALIVE_KEEPER_ENABLED in the main config file and set it's value to True in order to enable the keeper. """ Makes the transport ping itself, so it can detect connection hang diff --git a/extensions/avatar_hash.README.md b/extensions/avatar_hash.README.md new file mode 100644 index 0000000..3eac784 --- /dev/null +++ b/extensions/avatar_hash.README.md @@ -0,0 +1,10 @@ +Installation +==== + +Add a field named ENABLE_PHOTO_HASHES in the main config file and set it's value to True in order to enable sending photo hashes. It will make the clients show the users photos. + +Example: + +```python +ENABLE_PHOTO_HASHES = True +```
\ No newline at end of file diff --git a/extensions/groupchats.README.md b/extensions/groupchats.README.md new file mode 100644 index 0000000..b08124e --- /dev/null +++ b/extensions/groupchats.README.md @@ -0,0 +1,26 @@ +Installation +==== + +The extension “groupchats” requires up to 2 fields in the main config: + +1. ConferenceServer — the address of your (or not your?) conference server + +Bear in mind that there can be limits on the jabber server for conference per jid. Read the wiki for more details. + +2. CHAT_LIFETIME_LIMIT — the limit of the time after that chat considered inactive and will be removed. Time must be formatted as text and contain the time measurement variables after the digits. + +For example: + +```python +CHAT_LIFETIME_LIMIT = "28y09M21d" +``` + +Will make chats that were used 28 years 9 Months 21 ago deleted. + +You can wheter ignore or use any of these chars: *smdMy*. Those are the time measurement variables. + +Supported measurements: s for seconds, m for minutes, d for days, M for months, y for years. + +The number MUST contain 2 digits as well. + +Note: if you won't set the field, plugin won't remove any chat, but still will be gathering statistics and groupchats would work fine anyways. diff --git a/extensions/interpreter.py b/extensions/interpreter.py index 568c7f8..5dc6b46 100644 --- a/extensions/interpreter.py +++ b/extensions/interpreter.py @@ -5,25 +5,21 @@ def interpreter_msg02(msg): body = msg.getBody() - jidTo = msg.getTo() - destination = jidTo.getStripped() - jidFrom = msg.getFrom() - source = jidFrom.getStripped() - + destination = msg.getTo().getStripped() + source = msg.getFrom().getStripped() if body: answer = None - if jidTo == TransportID: + if destination == TransportID: raw = body.split(None, 1) if len(raw) > 1: text, args = raw args = args.strip() - if text == "!eval" and args and source in ADMIN_JIDS: try: result = unicode(eval(args)) except Exception: result = returnExc() - sendMessage(Component, source, jidTo, result) + sendMessage(Component, source, destination, result) elif text == "!exec" and args and source in ADMIN_JIDS: try: @@ -32,6 +28,6 @@ def interpreter_msg02(msg): result = returnExc() else: result = "Done." - sendMessage(Component, source, jidTo, result) + sendMessage(Component, source, destination, result) registerHandler("msg02", interpreter_msg02)
\ No newline at end of file diff --git a/extensions/user_activity.README.md b/extensions/user_activity.README.md new file mode 100644 index 0000000..71bdbea --- /dev/null +++ b/extensions/user_activity.README.md @@ -0,0 +1,22 @@ +Installation +==== + +Bear in mind that there can be limits on the jabber server for conference per jid. Read the wiki for more details. + +1. USER_LIFETIME_LIMIT — the limit of the time after that user considered inactive and will be removed. Time must be formatted as text and contain the time measurement variables after the digits. + +For example: + +```python +USER_LIFETIME_LIMIT = "28y09M21d" +``` + +Will make users who joined 28 years 9 Months 21 ago deleted. + +You can wheter ignore or use any of these chars: *smdMy*. Those are the time measurement variables. + +Supported measurements: s for seconds, m for minutes, d for days, M for months, y for years. + +The number MUST contain 2 digits as well. + +Note: if you won't set the field, plugin won't remove any user, but still will be gathering statistics. |