Skip to content
Commits on Source (13)
......@@ -11,15 +11,17 @@ EXTRA_DIST = \
intltool-merge.in \
intltool-update.in \
win \
scripts/gajim.in
scripts/gajim.in \
scripts/gajim-history-manager.in \
scripts/gajim-remote.in
DISTCLEANFILES = \
intltool-extract \
intltool-merge \
intltool-update \
scripts/gajim \
scripts/gajim-remote \
scripts/gajim-histrory-manager
scripts/gajim-history-manager
MAINTAINERCLEANFILES = \
configure \
......
......@@ -38,21 +38,10 @@ AC_SUBST(ACLOCAL_AMFLAGS)
AM_PATH_PYTHON([3.5])
dnl ****
dnl enable installation in python-2.x/site-packages/gajim
dnl ****
AC_ARG_ENABLE(site-packages,
[AS_HELP_STRING([--enable-site-packages],
[install gajim sources in PYTHONDIR/site-packages/gajim
instead of DATADIR/gajim/src.])]
,
AC_SUBST([gajim_srcdir], [\${pkgpythondir}])
,
AC_SUBST([gajim_srcdir], [\${datadir}/\${PACKAGE}/gajim])
)
AC_SUBST([gajim_pluginsdir], [\${datadir}/\${PACKAGE}/plugins])
AS_AC_EXPAND(PY_SITEDIR, "${pythondir}")
AS_AC_EXPAND(GAJIM_SRCDIR, "${gajim_srcdir}")
AS_AC_EXPAND(PKGDATADIR, "${datadir}/${PACKAGE}")
AS_AC_EXPAND(DOCDIR, "${docdir}")
......@@ -78,8 +67,8 @@ AC_CONFIG_FILES([
data/defs.py
gajim/Makefile
scripts/gajim
scripts/gajim-remote:scripts/gajim.in
scripts/gajim-history-manager:scripts/gajim.in
scripts/gajim-history-manager
scripts/gajim-remote
po/Makefile.in
plugins/Makefile
])
......
......@@ -29,12 +29,12 @@
from gi.repository import Gtk
import nbxmpp
from common import gajim
from common import dataforms
from gajim.common import app
from gajim.common import dataforms
import gtkgui_helpers
import dialogs
import dataforms_widget
from gajim import gtkgui_helpers
from gajim import dialogs
from gajim import dataforms_widget
class CommandWindow:
"""
......@@ -55,7 +55,7 @@ def __init__(self, account, jid, commandnode=None):
"""
# an account object
self.account = gajim.connections[account]
self.account = app.connections[account]
self.jid = jid
self.commandnode = commandnode
self.data_form_widget = None
......
......@@ -26,11 +26,11 @@
from enum import IntEnum, unique
from gi.repository import Gtk
import gtkgui_helpers
from gajim import gtkgui_helpers
from gi.repository import GLib
from gi.repository import Pango
from common import gajim
from gajim.common import app
@unique
class Column(IntEnum):
......@@ -73,7 +73,7 @@ def __init__(self):
self.xml = gtkgui_helpers.get_gtk_builder('advanced_configuration_window.ui')
self.window = self.xml.get_object('advanced_configuration_window')
self.window.set_transient_for(
gajim.interface.instances['preferences'].window)
app.interface.instances['preferences'].window)
self.entry = self.xml.get_object('advanced_entry')
self.desc_label = self.xml.get_object('advanced_desc_label')
self.restart_box = self.xml.get_object('restart_box')
......@@ -130,7 +130,7 @@ def __init__(self):
self.xml.connect_signals(self)
self.restart_box.set_no_show_all(True)
self.window.show_all()
gajim.interface.instances['advanced_config'] = self
app.interface.instances['advanced_config'] = self
def cb_value_column_data(self, col, cell, model, iter_, data):
"""
......@@ -166,9 +166,9 @@ def on_advanced_treeview_selection_changed(self, treeselection):
# Get text from first column in this row
desc = None
if len(opt_path) == 3:
desc = gajim.config.get_desc_per(opt_path[2], opt_path[0])
desc = app.config.get_desc_per(opt_path[2], opt_path[0])
elif len(opt_path) == 1:
desc = gajim.config.get_desc(opt_path[0])
desc = app.config.get_desc(opt_path[0])
if desc:
self.desc_label.set_text(desc)
else:
......@@ -205,10 +205,10 @@ def on_advanced_treeview_row_activated(self, treeview, path, column):
key = keyrow[0]
self.remember_option(option + '\n' + key + '\n' + optname,
modelrow[1], newval)
gajim.config.set_per(optname, key, option, newval)
app.config.set_per(optname, key, option, newval)
else:
self.remember_option(option, modelrow[1], newval)
gajim.config.set(option, newval)
app.config.set(option, newval)
modelrow[1] = self.right_true_dict[newval]
self.check_for_restart()
......@@ -217,10 +217,10 @@ def check_for_restart(self):
for opt in self.changed_opts:
opt_path = opt.split('\n')
if len(opt_path)==3:
restart = gajim.config.get_restart_per(opt_path[2], opt_path[1],
restart = app.config.get_restart_per(opt_path[2], opt_path[1],
opt_path[0])
else:
restart = gajim.config.get_restart(opt_path[0])
restart = app.config.get_restart(opt_path[0])
if restart:
if self.changed_opts[opt][0] != self.changed_opts[opt][1]:
self.restart_box.set_no_show_all(False)
......@@ -242,16 +242,16 @@ def on_config_edited(self, cell, path, text):
optname = optnamerow[0]
self.remember_option(option + '\n' + key + '\n' + optname, modelrow[1],
text)
gajim.config.set_per(optname, key, option, text)
app.config.set_per(optname, key, option, text)
else:
self.remember_option(option, modelrow[1], text)
gajim.config.set(option, text)
app.config.set(option, text)
modelrow[1] = text
self.check_for_restart()
@staticmethod
def on_advanced_configuration_window_destroy(widget):
del gajim.interface.instances['advanced_config']
del app.interface.instances['advanced_config']
def on_reset_button_clicked(self, widget):
model, iter_ = self.treeview.get_selection().get_selected()
......@@ -260,9 +260,9 @@ def on_reset_button_clicked(self, widget):
path = model.get_path(iter_)
opt_path = self.get_option_path(model, iter_)
if len(opt_path) == 1:
default = gajim.config.get_default(opt_path[0])
default = app.config.get_default(opt_path[0])
elif len(opt_path) == 3:
default = gajim.config.get_default_per(opt_path[2], opt_path[0])
default = app.config.get_default_per(opt_path[2], opt_path[0])
if model[iter_][Column.TYPE] == self.types['boolean']:
if self.right_true_dict[default] == model[iter_][Column.VALUE]:
......@@ -277,10 +277,10 @@ def on_reset_button_clicked(self, widget):
key = keyrow[0]
self.remember_option(option + '\n' + key + '\n' + optname,
modelrow[Column.VALUE], default)
gajim.config.set_per(optname, key, option, default)
app.config.set_per(optname, key, option, default)
else:
self.remember_option(option, modelrow[Column.VALUE], default)
gajim.config.set(option, default)
app.config.set(option, default)
modelrow[Column.VALUE] = self.right_true_dict[default]
self.check_for_restart()
else:
......@@ -292,16 +292,16 @@ def on_advanced_close_button_clicked(self, widget):
self.window.destroy()
def fill_model(self, node=None, parent=None):
for item, option in gajim.config.get_children(node):
for item, option in app.config.get_children(node):
name = item[-1]
if option is None: # Node
newparent = self.model.append(parent, [name, '', ''])
self.fill_model(item, newparent)
else: # Leaf
if len(item) == 1:
type_ = self.types[gajim.config.get_type(name)]
type_ = self.types[app.config.get_type(name)]
elif len(item) == 3:
type_ = self.types[gajim.config.get_type_per(item[0],
type_ = self.types[app.config.get_type_per(item[0],
item[2])]
if name == 'password':
value = _('Hidden')
......@@ -321,9 +321,9 @@ def visible_func(self, model, treeiter, data):
if model[it][Column.TYPE] != '':
opt_path = self.get_option_path(model, it)
if len(opt_path) == 3:
desc = gajim.config.get_desc_per(opt_path[2], opt_path[0])
desc = app.config.get_desc_per(opt_path[2], opt_path[0])
elif len(opt_path) == 1:
desc = gajim.config.get_desc(opt_path[0])
desc = app.config.get_desc(opt_path[0])
if search_string in model[it][Column.PREFERENCE_NAME] or (desc and \
search_string in desc.lower()):
return True
......
......@@ -18,70 +18,64 @@
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
##
from common import helpers
from common import gajim
from common.exceptions import GajimGeneralException
from gajim.common import app
from gajim.common import helpers
from gajim.common.app import interface
from gajim.common.exceptions import GajimGeneralException
from gi.repository import Gtk
import sys
import os
import config
import dialogs
import features_window
import shortcuts_window
import plugins.gui
import history_window
import disco
from history_sync import HistorySyncAssistant
from server_info import ServerInfoDialog
from gajim import config
from gajim import dialogs
from gajim import features_window
from gajim import shortcuts_window
import gajim.plugins.gui
from gajim import history_window
from gajim import disco
from gajim.history_sync import HistorySyncAssistant
from gajim.server_info import ServerInfoDialog
class AppActions():
''' Action Callbacks '''
def __init__(self, app: Gtk.Application):
self.application = app
def __init__(self, application: Gtk.Application):
self.application = application
# Application Menu Actions
def on_preferences(self, action, param):
if 'preferences' in gajim.interface.instances:
gajim.interface.instances['preferences'].window.present()
if 'preferences' in interface.instances:
interface.instances['preferences'].window.present()
else:
gajim.interface.instances['preferences'] = \
interface.instances['preferences'] = \
config.PreferencesWindow()
def on_plugins(self, action, param):
if 'plugins' in gajim.interface.instances:
gajim.interface.instances['plugins'].window.present()
if 'plugins' in interface.instances:
interface.instances['plugins'].window.present()
else:
gajim.interface.instances['plugins'] = plugins.gui.PluginsWindow()
interface.instances['plugins'] = gajim.plugins.gui.PluginsWindow()
def on_accounts(self, action, param):
if 'accounts' in gajim.interface.instances:
gajim.interface.instances['accounts'].window.present()
if 'accounts' in interface.instances:
interface.instances['accounts'].window.present()
else:
gajim.interface.instances['accounts'] = config.AccountsWindow()
interface.instances['accounts'] = config.AccountsWindow()
def on_history_manager(self, action, param):
config_path = '-c %s' % gajim.gajimpaths.data_root
posix = os.name != 'nt'
if os.path.exists('history_manager.exe'): # Windows
helpers.exec_command('history_manager.exe %s' % config_path,
posix=posix)
else: # Linux or running from Git
helpers.exec_command(
'%s history_manager.py %s' % (sys.executable, config_path),
posix=posix)
from gajim.history_manager import HistoryManager
HistoryManager()
def on_manage_bookmarks(self, action, param):
config.ManageBookmarksWindow()
def on_quit(self, action, param):
gajim.interface.roster.on_quit_request()
interface.roster.on_quit_request()
# Accounts Actions
def on_profile(self, action, param):
gajim.interface.edit_own_details(param.get_string())
interface.edit_own_details(param.get_string())
def on_activate_bookmark(self, action, param):
dict_ = param.unpack()
......@@ -91,19 +85,19 @@ def on_activate_bookmark(self, action, param):
nick = dict_['nick']
if 'password' in dict_:
password = dict_['password']
gajim.interface.join_gc_room(account, jid, nick, password)
interface.join_gc_room(account, jid, nick, password)
def on_send_server_message(self, action, param):
account = param.get_string()
server = gajim.config.get_per('accounts', account, 'hostname')
server = app.config.get_per('accounts', account, 'hostname')
server += '/announce/online'
dialogs.SingleMessageWindow(account, server, 'send')
def on_service_disco(self, action, param):
account = param.get_string()
server_jid = gajim.config.get_per('accounts', account, 'hostname')
if server_jid in gajim.interface.instances[account]['disco']:
gajim.interface.instances[account]['disco'][server_jid].\
server_jid = app.config.get_per('accounts', account, 'hostname')
if server_jid in interface.instances[account]['disco']:
interface.instances[account]['disco'][server_jid].\
window.present()
else:
try:
......@@ -114,16 +108,16 @@ def on_service_disco(self, action, param):
def on_join_gc(self, action, param):
account = param.get_string()
invisible_show = gajim.SHOW_LIST.index('invisible')
if gajim.connections[account].connected == invisible_show:
invisible_show = app.SHOW_LIST.index('invisible')
if app.connections[account].connected == invisible_show:
dialogs.ErrorDialog(_(
'You cannot join a group chat while you are invisible'))
return
if 'join_gc' in gajim.interface.instances[account]:
gajim.interface.instances[account]['join_gc'].window.present()
if 'join_gc' in interface.instances[account]:
interface.instances[account]['join_gc'].window.present()
else:
try:
gajim.interface.instances[account]['join_gc'] = \
interface.instances[account]['join_gc'] = \
dialogs.JoinGroupchatWindow(account)
except GajimGeneralException:
pass
......@@ -141,64 +135,64 @@ def on_single_message(self, action, param):
def on_archiving_preferences(self, action, param):
account = param.get_string()
if 'archiving_preferences' in gajim.interface.instances[account]:
gajim.interface.instances[account]['archiving_preferences'].window.\
if 'archiving_preferences' in interface.instances[account]:
interface.instances[account]['archiving_preferences'].window.\
present()
else:
gajim.interface.instances[account]['archiving_preferences'] = \
interface.instances[account]['archiving_preferences'] = \
dialogs.Archiving313PreferencesWindow(account)
def on_history_sync(self, action, param):
account = param.get_string()
if 'history_sync' in gajim.interface.instances[account]:
gajim.interface.instances[account]['history_sync'].present()
if 'history_sync' in interface.instances[account]:
interface.instances[account]['history_sync'].present()
else:
gajim.interface.instances[account]['history_sync'] = \
HistorySyncAssistant(account, gajim.interface.roster.window)
interface.instances[account]['history_sync'] = \
HistorySyncAssistant(account, interface.roster.window)
def on_privacy_lists(self, action, param):
account = param.get_string()
if 'privacy_lists' in gajim.interface.instances[account]:
gajim.interface.instances[account]['privacy_lists'].window.present()
if 'privacy_lists' in interface.instances[account]:
interface.instances[account]['privacy_lists'].window.present()
else:
gajim.interface.instances[account]['privacy_lists'] = \
interface.instances[account]['privacy_lists'] = \
dialogs.PrivacyListsWindow(account)
def on_server_info(self, action, param):
account = param.get_string()
if 'server_info' in gajim.interface.instances[account]:
gajim.interface.instances[account]['server_info'].present()
if 'server_info' in interface.instances[account]:
interface.instances[account]['server_info'].present()
else:
gajim.interface.instances[account]['server_info'] = \
interface.instances[account]['server_info'] = \
ServerInfoDialog(account)
def on_xml_console(self, action, param):
account = param.get_string()
if 'xml_console' in gajim.interface.instances[account]:
gajim.interface.instances[account]['xml_console'].present()
if 'xml_console' in interface.instances[account]:
interface.instances[account]['xml_console'].present()
else:
gajim.interface.instances[account]['xml_console'] = \
interface.instances[account]['xml_console'] = \
dialogs.XMLConsoleWindow(account)
# Admin Actions
def on_set_motd(self, action, param):
account = param.get_string()
server = gajim.config.get_per('accounts', account, 'hostname')
server = app.config.get_per('accounts', account, 'hostname')
server += '/announce/motd'
dialogs.SingleMessageWindow(account, server, 'send')
def on_update_motd(self, action, param):
account = param.get_string()
server = gajim.config.get_per('accounts', account, 'hostname')
server = app.config.get_per('accounts', account, 'hostname')
server += '/announce/motd/update'
dialogs.SingleMessageWindow(account, server, 'send')
def on_delete_motd(self, action, param):
account = param.get_string()
server = gajim.config.get_per('accounts', account, 'hostname')
server = app.config.get_per('accounts', account, 'hostname')
server += '/announce/motd/delete'
gajim.connections[account].send_motd(server)
app.connections[account].send_motd(server)
# Help Actions
......@@ -222,15 +216,15 @@ def on_about(self, action, param):
# View Actions
def on_file_transfers(self, action, param):
if gajim.interface.instances['file_transfers']. \
if interface.instances['file_transfers']. \
window.get_property('visible'):
gajim.interface.instances['file_transfers'].window.present()
interface.instances['file_transfers'].window.present()
else:
gajim.interface.instances['file_transfers'].window.show_all()
interface.instances['file_transfers'].window.show_all()
def on_history(self, action, param):
if 'logs' in gajim.interface.instances:
gajim.interface.instances['logs'].window.present()
if 'logs' in interface.instances:
interface.instances['logs'].window.present()
else:
gajim.interface.instances['logs'] = history_window.\
interface.instances['logs'] = history_window.\
HistoryWindow()
......@@ -25,9 +25,9 @@
from gi.repository import Gdk
from gi.repository import GLib
import gtkgui_helpers
from common import helpers
from common import i18n
from gajim import gtkgui_helpers
from gajim.common import helpers
from gajim.common import i18n
class AtomWindow:
window = None
......
This diff is collapsed.
This diff is collapsed.
......@@ -31,7 +31,7 @@
over the process.
"""
from .tools import remove
from gajim.command_system.tools import remove
COMMANDS = {}
CONTAINERS = {}
......@@ -66,7 +66,7 @@ def traverse_commands(container):
yield attribute
def is_command(attribute):
from .framework import Command
from gajim.command_system.framework import Command
return isinstance(attribute, Command)
def is_root(namespace):
......@@ -115,4 +115,4 @@ def enable(self):
def disable(self):
remove_commands(self)
remove_container(self)
\ No newline at end of file
remove_container(self)
......@@ -22,10 +22,10 @@
from types import FunctionType
from inspect import getargspec, getdoc
from .dispatcher import Host, Container
from .dispatcher import get_command, list_commands
from .mapping import parse_arguments, adapt_arguments
from .errors import DefinitionError, CommandError, NoCommandError
from gajim.command_system.dispatcher import Host, Container
from gajim.command_system.dispatcher import get_command, list_commands
from gajim.command_system.mapping import parse_arguments, adapt_arguments
from gajim.command_system.errors import DefinitionError, CommandError, NoCommandError
class CommandHost(metaclass=Host):
"""
......
......@@ -34,8 +34,8 @@
detected.
"""
from ..framework import CommandContainer, command, doc
from .hosts import ChatCommands, PrivateChatCommands, GroupChatCommands
from gajim.command_system.framework import CommandContainer, command, doc
from gajim.command_system.implementation.hosts import ChatCommands, PrivateChatCommands, GroupChatCommands
class CustomCommonCommands(CommandContainer):
"""
......
......@@ -37,8 +37,8 @@
from gi.repository import GLib
from ..framework import CommandContainer, command, doc
from .hosts import ChatCommands, PrivateChatCommands, GroupChatCommands
from gajim.command_system.framework import CommandContainer, command, doc
from gajim.command_system.implementation.hosts import ChatCommands, PrivateChatCommands, GroupChatCommands
class Execute(CommandContainer):
AUTOMATIC = True
......
......@@ -18,7 +18,7 @@
different command processors, which are the source of commands.
"""
from ..framework import CommandHost
from gajim.command_system.framework import CommandHost
class ChatCommands(CommandHost):
"""
......
......@@ -34,10 +34,10 @@
from traceback import print_exc
from gi.repository import Pango
from common import gajim
from gajim.common import app
from ..framework import CommandProcessor
from ..errors import CommandError, NoCommandError
from gajim.command_system.framework import CommandProcessor
from gajim.command_system.errors import CommandError, NoCommandError
class ChatCommandProcessor(CommandProcessor):
"""
......@@ -179,7 +179,7 @@ def connection(self):
"""
Get the current connection object.
"""
return gajim.connections[self.account]
return app.connections[self.account]
@property
def full_jid(self):
......
......@@ -20,17 +20,17 @@
from time import localtime, strftime
from datetime import date
import dialogs
from common import gajim
from common import helpers
from common.exceptions import GajimGeneralException
from common.logger import KindConstant
from gajim import dialogs
from gajim.common import app
from gajim.common import helpers
from gajim.common.exceptions import GajimGeneralException
from gajim.common.logger import KindConstant
from ..errors import CommandError
from ..framework import CommandContainer, command, doc
from ..mapping import generate_usage
from gajim.command_system.errors import CommandError
from gajim.command_system.framework import CommandContainer, command, doc
from gajim.command_system.mapping import generate_usage
from .hosts import ChatCommands, PrivateChatCommands, GroupChatCommands
from gajim.command_system.implementation.hosts import ChatCommands, PrivateChatCommands, GroupChatCommands
class StandardCommonCommands(CommandContainer):
"""
......@@ -87,7 +87,7 @@ def me(self, action):
@command('lastlog', overlap=True)
@doc(_("Show logged messages which mention given text"))
def grep(self, text, limit=None):
results = gajim.logger.search_log(self.account, self.contact.jid, text)
results = app.logger.search_log(self.account, self.contact.jid, text)
if not results:
raise CommandError(_("%s: Nothing found") % text)
......@@ -102,7 +102,7 @@ def grep(self, text, limit=None):
contact = row.contact_name
if not contact:
if row.kind == KindConstant.CHAT_MSG_SENT:
contact = gajim.nicks[self.account]
contact = app.nicks[self.account]
else:
contact = self.contact.name
......@@ -129,8 +129,8 @@ def grep(self, text, limit=None):
def status(self, status, message):
if status not in ('online', 'away', 'chat', 'xa', 'dnd'):
raise CommandError("Invalid status given")
for connection in gajim.connections.values():
if not gajim.config.get_per('accounts', connection.name,
for connection in app.connections.values():
if not app.config.get_per('accounts', connection.name,
'sync_with_global_status'):
continue
if connection.connected < 2:
......@@ -143,8 +143,8 @@ def away(self, message):
if not message:
message = _("Away")
for connection in gajim.connections.values():
if not gajim.config.get_per('accounts', connection.name,
for connection in app.connections.values():
if not app.config.get_per('accounts', connection.name,
'sync_with_global_status'):
continue
if connection.connected < 2:
......@@ -157,8 +157,8 @@ def online(self, message):
if not message:
message = _("Available")
for connection in gajim.connections.values():
if not gajim.config.get_per('accounts', connection.name,
for connection in app.connections.values():
if not app.config.get_per('accounts', connection.name,
'sync_with_global_status'):
continue
if connection.connected < 2:
......@@ -182,9 +182,9 @@ def clear(self):
@command
@doc(_("Send a ping to the contact"))
def ping(self):
if self.account == gajim.ZEROCONF_ACC_NAME:
if self.account == app.ZEROCONF_ACC_NAME:
raise CommandError(_('Command is not supported for zeroconf accounts'))
gajim.connections[self.account].sendPing(self.contact)
app.connections[self.account].sendPing(self.contact)
@command
@doc(_("Send DTMF sequence through an open audio session"))
......@@ -271,7 +271,7 @@ def nick(self, new_nick):
@command('query', raw=True)
@doc(_("Open a private chat window with a specified occupant"))
def chat(self, nick):
nicks = gajim.contacts.get_nick_list(self.account, self.room_jid)
nicks = app.contacts.get_nick_list(self.account, self.room_jid)
if nick in nicks:
self.on_send_pm(nick=nick)
else:
......@@ -280,7 +280,7 @@ def chat(self, nick):
@command('msg', raw=True)
@doc(_("Open a private chat window with a specified occupant and send him a message"))
def message(self, nick, a_message):
nicks = gajim.contacts.get_nick_list(self.account, self.room_jid)
nicks = app.contacts.get_nick_list(self.account, self.room_jid)
if nick in nicks:
self.on_send_pm(nick=nick, msg=a_message)
else:
......@@ -307,10 +307,10 @@ def join(self, jid, nick):
nick = self.nick
if '@' not in jid:
jid = jid + '@' + gajim.get_server_from_jid(self.room_jid)
jid = jid + '@' + app.get_server_from_jid(self.room_jid)
try:
gajim.interface.instances[self.account]['join_gc'].window.present()
app.interface.instances[self.account]['join_gc'].window.present()
except KeyError:
try:
dialogs.JoinGroupchatWindow(account=self.account, room_jid=jid, nick=nick)
......@@ -329,15 +329,15 @@ def leave(self, reason):
If given nickname is not found it will be treated as a jid.
"""))
def ban(self, who, reason):
if who in gajim.contacts.get_nick_list(self.account, self.room_jid):
contact = gajim.contacts.get_gc_contact(self.account, self.room_jid, who)
if who in app.contacts.get_nick_list(self.account, self.room_jid):
contact = app.contacts.get_gc_contact(self.account, self.room_jid, who)
who = contact.jid
self.connection.gc_set_affiliation(self.room_jid, who, 'outcast', reason or str())
@command(raw=True, empty=True)
@doc(_("Kick user by a nick from a groupchat"))
def kick(self, who, reason):
if not who in gajim.contacts.get_nick_list(self.account, self.room_jid):
if not who in app.contacts.get_nick_list(self.account, self.room_jid):
raise CommandError(_("Nickname not found"))
self.connection.gc_set_role(self.room_jid, who, 'none', reason or str())
......@@ -349,7 +349,7 @@ def kick(self, who, reason):
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):
if not who in app.contacts.get_nick_list(self.account, self.room_jid):
raise CommandError(_("Nickname not found"))
self.connection.gc_set_role(self.room_jid, who, role)
......@@ -361,17 +361,17 @@ def role(self, who, role):
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):
if not who in app.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)
contact = app.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):
ggc = gajim.contacts.get_gc_contact
gnl = gajim.contacts.get_nick_list
ggc = app.contacts.get_gc_contact
gnl = app.contacts.get_nick_list
get_contact = lambda nick: ggc(self.account, self.room_jid, nick)
get_role = lambda nick: get_contact(nick).role
......@@ -402,8 +402,8 @@ def unblock(self, who):
@command
@doc(_("Send a ping to the contact"))
def ping(self, nick):
if self.account == gajim.ZEROCONF_ACC_NAME:
if self.account == app.ZEROCONF_ACC_NAME:
raise CommandError(_('Command is not supported for zeroconf accounts'))
gc_c = gajim.contacts.get_gc_contact(self.account, self.room_jid, nick)
gajim.connections[self.account].sendPing(gc_c, self)
gc_c = app.contacts.get_gc_contact(self.account, self.room_jid, nick)
app.connections[self.account].sendPing(gc_c, self)
......@@ -25,7 +25,7 @@
import re
from operator import itemgetter
from .errors import DefinitionError, CommandError
from gajim.command_system.errors import DefinitionError, CommandError
# Quite complex piece of regular expression logic to parse options and
# arguments. Might need some tweaking along the way.
......
# -*- coding:utf-8 -*-
## src/common/gajim.py
## gajim/common/app.py
##
## Copyright (C) 2003-2014 Yann Leboulanger <asterix AT lagaule.org>
## Copyright (C) 2005-2006 Dimitur Kirov <dkirov AT gmail.com>
......@@ -34,9 +34,9 @@
import uuid
from distutils.version import LooseVersion as V
from common import config
from gajim.common import config
import nbxmpp
from common import ged as ged_module
from gajim.common import ged as ged_module
interface = None # The actual interface (the gtk one for the moment)
thread_interface = None # Interface to run a thread and then a callback
......@@ -54,7 +54,7 @@
logger = None
from common import configpaths
from gajim.common import configpaths
gajimpaths = configpaths.gajimpaths
VCARD_PATH = gajimpaths['VCARD']
......@@ -86,8 +86,8 @@
os_info = None # used to cache os information
from common.contacts import LegacyContactsAPI
from common.events import Events
from gajim.common.contacts import LegacyContactsAPI
from gajim.common.events import Events
gmail_domains = ['gmail.com', 'googlemail.com']
......@@ -144,7 +144,7 @@
# zeroconf account name
ZEROCONF_ACC_NAME = 'Local'
# These will be set in gajim.gui_interface.
# These will be set in app.gui_interface.
idlequeue = None
socks5queue = None
......
......@@ -9,7 +9,7 @@
raise ImportError
from pyasn1.type import univ, constraint, char, namedtype, tag
from pyasn1.codec.der.decoder import decode
from common.helpers import prep, InvalidFormat
from gajim.common.helpers import prep, InvalidFormat
MAX = 64
oid_xmppaddr = '1.3.6.1.5.5.7.8.5'
......
......@@ -27,8 +27,8 @@
import shutil
import sys
from common import gajim
from common import logger
from gajim.common import app
from gajim.common import logger
# DO NOT MOVE ABOVE OF import gajim
import sqlite3 as sqlite
......@@ -173,13 +173,13 @@ def check_and_possibly_move_config():
LOG_DB_PATH = logger.LOG_DB_PATH
CACHE_DB_PATH = logger.CACHE_DB_PATH
vars = {}
vars['VCARD_PATH'] = gajim.VCARD_PATH
vars['AVATAR_PATH'] = gajim.AVATAR_PATH
vars['MY_EMOTS_PATH'] = gajim.MY_EMOTS_PATH
vars['MY_ICONSETS_PATH'] = gajim.MY_ICONSETS_PATH
vars['MY_MOOD_ICONSETS_PATH'] = gajim.MY_MOOD_ICONSETS_PATH
vars['MY_ACTIVITY_ICONSETS_PATH'] = gajim.MY_ACTIVITY_ICONSETS_PATH
from common import configpaths
vars['VCARD_PATH'] = app.VCARD_PATH
vars['AVATAR_PATH'] = app.AVATAR_PATH
vars['MY_EMOTS_PATH'] = app.MY_EMOTS_PATH
vars['MY_ICONSETS_PATH'] = app.MY_ICONSETS_PATH
vars['MY_MOOD_ICONSETS_PATH'] = app.MY_MOOD_ICONSETS_PATH
vars['MY_ACTIVITY_ICONSETS_PATH'] = app.MY_ACTIVITY_ICONSETS_PATH
from gajim.common import configpaths
MY_DATA = configpaths.gajimpaths['MY_DATA']
MY_CONFIG = configpaths.gajimpaths['MY_CONFIG']
MY_CACHE = configpaths.gajimpaths['MY_CACHE']
......@@ -252,8 +252,8 @@ def check_and_possibly_move_config():
continue
print(_('moving %s to %s') % (src, dst))
shutil.move(src, dst)
gajim.logger.init_vars()
gajim.logger.attach_cache_database()
app.logger.init_vars()
app.logger.attach_cache_database()
def check_and_possibly_create_paths():
LOG_DB_PATH = logger.LOG_DB_PATH
......@@ -262,16 +262,16 @@ def check_and_possibly_create_paths():
CACHE_DB_PATH = logger.CACHE_DB_PATH
CACHE_DB_FOLDER, CACHE_DB_FILE = os.path.split(CACHE_DB_PATH)
VCARD_PATH = gajim.VCARD_PATH
AVATAR_PATH = gajim.AVATAR_PATH
from common import configpaths
VCARD_PATH = app.VCARD_PATH
AVATAR_PATH = app.AVATAR_PATH
from gajim.common import configpaths
MY_DATA = configpaths.gajimpaths['MY_DATA']
MY_CONFIG = configpaths.gajimpaths['MY_CONFIG']
MY_CACHE = configpaths.gajimpaths['MY_CACHE']
XTLS_CERTS = configpaths.gajimpaths['MY_PEER_CERTS']
LOCAL_XTLS_CERTS = configpaths.gajimpaths['MY_CERT']
PLUGINS_CONFIG_PATH = gajim.PLUGINS_CONFIG_DIR
PLUGINS_CONFIG_PATH = app.PLUGINS_CONFIG_DIR
if not os.path.exists(MY_DATA):
create_path(MY_DATA)
......@@ -335,7 +335,7 @@ def check_and_possibly_create_paths():
if os.path.exists(CACHE_DB_PATH):
os.remove(CACHE_DB_PATH)
create_log_db()
gajim.logger.init_vars()
app.logger.init_vars()
elif os.path.isdir(LOG_DB_PATH):
print(_('%s is a directory but should be a file') % LOG_DB_PATH)
print(_('Gajim will now exit'))
......@@ -343,7 +343,7 @@ def check_and_possibly_create_paths():
if not os.path.exists(CACHE_DB_PATH):
create_cache_db()
gajim.logger.attach_cache_database()
app.logger.attach_cache_database()
elif os.path.isdir(CACHE_DB_PATH):
print(_('%s is a directory but should be a file') % CACHE_DB_PATH)
print(_('Gajim will now exit'))
......