changeset e3941cc6b21a in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=e3941cc6b21a
description: Add 'role' and 'affiliate' command to command system.
diffstat:
src/command_system/implementation/middleware.py | 2 +-
src/command_system/implementation/standard.py | 24 ++++++++++++++++++++++++
src/command_system/mapping.py | 8 ++++----
3 files changed, 29 insertions(+), 5 deletions(-)
diffs (85 lines):
diff -r 42f7ecdf64a2 -r e3941cc6b21a src/command_system/implementation/middleware.py
--- a/src/command_system/implementation/middleware.py Fri Aug 10 10:43:02 2012 +0200
+++ b/src/command_system/implementation/middleware.py Sat Aug 11 14:59:05 2012 +0400
@@ -71,7 +71,7 @@
except CommandError, error:
self.echo_error("%s: %s" % (error.name, error.message))
except Exception:
- self.echo_error("Error during command execution!")
+ self.echo_error(_("Error during command execution!"))
print_exc()
else:
self.command_succeeded = True
diff -r 42f7ecdf64a2 -r e3941cc6b21a src/command_system/implementation/standard.py
--- a/src/command_system/implementation/standard.py Fri Aug 10 10:43:02 2012 +0200
+++ b/src/command_system/implementation/standard.py Sat Aug 11 14:59:05 2012 +0400
@@ -352,6 +352,30 @@
raise CommandError(_("Nickname not found"))
self.connection.gc_set_role(self.room_jid, who, 'none', reason or str())
+ @command(raw=True)
+ @doc(_("""Set occupant role in group chat.
+ Role can be given as one of the following values:
+ moderator, participant, visitor, none"""))
+ def role(self, who, role):
+ if role not in ('moderator', 'participant', 'visitor', 'none'):
+ raise CommandError(_("Invalid role given"))
+ if not who in gajim.contacts.get_nick_list(self.account, self.room_jid):
+ raise CommandError(_("Nickname not found"))
+ self.connection.gc_set_role(self.room_jid, who, role)
+
+ @command(raw=True)
+ @doc(_("""Set occupant affiliation in group chat.
+ Affiliation can be given as one of the following values:
+ owner, admin, member, outcast, none"""))
+ def affiliate(self, who, affiliation):
+ if affiliation not in ('owner', 'admin', 'member', 'outcast', 'none'):
+ raise CommandError(_("Invalid affiliation given"))
+ if not who in gajim.contacts.get_nick_list(self.account, self.room_jid):
+ raise CommandError(_("Nickname not found"))
+ contact = gajim.contacts.get_gc_contact(self.account, self.room_jid, who)
+ self.connection.gc_set_affiliation(self.room_jid, contact.jid,
+ affiliation)
+
@command
@doc(_("Display names of all group chat occupants"))
def names(self, verbose=False):
diff -r 42f7ecdf64a2 -r e3941cc6b21a src/command_system/mapping.py
--- a/src/command_system/mapping.py Fri Aug 10 10:43:02 2012 +0200
+++ b/src/command_system/mapping.py Sat Aug 11 14:59:05 2012 +0400
@@ -162,7 +162,7 @@
try:
stopper, (start, end) = args[spec_len - 2]
except IndexError:
- raise CommandError("Missing arguments", command)
+ raise CommandError(_("Missing arguments"), command)
# The essential point of the whole play. After
# boundaries are being determined (supposingly correct)
@@ -172,7 +172,7 @@
raw = raw.strip() or None
if not raw and not command.empty:
- raise CommandError("Missing arguments", command)
+ raise CommandError(_("Missing arguments"), command)
# Discard residual arguments and all of the options as
# raw command does not support options and if an option
@@ -192,7 +192,7 @@
if command.empty:
args.append((None, (0, 0)))
else:
- raise CommandError("Missing arguments", command)
+ raise CommandError(_("Missing arguments"), command)
# The first stage of transforming options we have got to a format
# that can be used to associate them with declared keyword
@@ -259,7 +259,7 @@
for arg, (spec_key, spec_value) in zip(overlapped, spec_kwargs):
opts.append((spec_key, arg))
else:
- raise CommandError("Excessive arguments", command)
+ raise CommandError(_("Excessive arguments"), command)
# Detect every switch and ensure it will not receive any arguments.
# Normally this does not happen unless overlapping is enabled.
changeset cb7602bb9c5c in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=cb7602bb9c5c
description: first load the plugins of the user directory. does not load the module twice.
diffstat:
src/plugins/pluginmanager.py | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diffs (22 lines):
diff -r 27b33dd6fe25 -r cb7602bb9c5c src/plugins/pluginmanager.py
--- a/src/plugins/pluginmanager.py Sun Aug 05 13:34:35 2012 +0200
+++ b/src/plugins/pluginmanager.py Thu Aug 09 21:48:00 2012 +0400
@@ -100,7 +100,7 @@
'''
Registered handlers of GUI extension points.
'''
- for path in gajim.PLUGINS_DIRS:
+ for path in [gajim.PLUGINS_DIRS[1], gajim.PLUGINS_DIRS[0]):
pc = PluginManager.scan_dir_for_plugins(path)
self.add_plugins(pc)
self._activate_all_plugins_from_global_config()
@@ -433,6 +433,9 @@
elif os.path.isdir(file_path) and scan_dirs:
module_name = elem_name
+ if module_name in sys.modules:
+ # do not load the module twice
+ continue
file_path += os.path.sep
try:
module = __import__(module_name)