Commit 89c7eb6e authored by André's avatar André

Rename gajim.common.gajim to avoid name conflicts

parent 56d002ce
......@@ -29,7 +29,7 @@ from gi.repository import GLib
from gi.repository import Gtk
import nbxmpp
from gajim.common import gajim
from gajim.common import app
from gajim.common import dataforms
from gajim import gtkgui_helpers
......@@ -55,7 +55,7 @@ class CommandWindow:
"""
# an account object
self.account = gajim.connections[account]
self.account = app.connections[account]
self.jid = jid
self.commandnode = commandnode
self.data_form_widget = None
......
......@@ -30,7 +30,7 @@ from gajim import gtkgui_helpers
from gi.repository import GLib
from gi.repository import Pango
from gajim.common import gajim
from gajim.common import app
@unique
class Column(IntEnum):
......@@ -73,7 +73,7 @@ class AdvancedConfigurationWindow(object):
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 @@ class AdvancedConfigurationWindow(object):
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 @@ class AdvancedConfigurationWindow(object):
# 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 @@ class AdvancedConfigurationWindow(object):
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 @@ class AdvancedConfigurationWindow(object):
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 @@ class AdvancedConfigurationWindow(object):
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 @@ class AdvancedConfigurationWindow(object):
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 @@ class AdvancedConfigurationWindow(object):
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 @@ class AdvancedConfigurationWindow(object):
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 @@ class AdvancedConfigurationWindow(object):
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,9 +18,9 @@
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
##
from gajim.common import gajim as c_gajim
from gajim.common import app
from gajim.common import helpers
from gajim.common.gajim import interface
from gajim.common.app import interface
from gajim.common.exceptions import GajimGeneralException
from gi.repository import Gtk
import sys
......@@ -38,8 +38,8 @@ 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
......@@ -89,13 +89,13 @@ class AppActions():
def on_send_server_message(self, action, param):
account = param.get_string()
server = c_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 = c_gajim.config.get_per('accounts', account, 'hostname')
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()
......@@ -108,8 +108,8 @@ class AppActions():
def on_join_gc(self, action, param):
account = param.get_string()
invisible_show = c_gajim.SHOW_LIST.index('invisible')
if c_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
......@@ -178,21 +178,21 @@ class AppActions():
def on_set_motd(self, action, param):
account = param.get_string()
server = c_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 = c_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 = c_gajim.config.get_per('accounts', account, 'hostname')
server = app.config.get_per('accounts', account, 'hostname')
server += '/announce/motd/delete'
c_gajim.connections[account].send_motd(server)
app.connections[account].send_motd(server)
# Help Actions
......
This diff is collapsed.
This diff is collapsed.
......@@ -34,7 +34,7 @@ don't need to dig up the code itself to write basic commands.
from traceback import print_exc
from gi.repository import Pango
from gajim.common import gajim
from gajim.common import app
from gajim.command_system.framework import CommandProcessor
from gajim.command_system.errors import CommandError, NoCommandError
......@@ -179,7 +179,7 @@ class CommandTools:
"""
Get the current connection object.
"""
return gajim.connections[self.account]
return app.connections[self.account]
@property
def full_jid(self):
......
......@@ -21,7 +21,7 @@ from time import localtime, strftime
from datetime import date
from gajim import dialogs
from gajim.common import gajim
from gajim.common import app
from gajim.common import helpers
from gajim.common.exceptions import GajimGeneralException
from gajim.common.logger import KindConstant
......@@ -87,7 +87,7 @@ class StandardCommonCommands(CommandContainer):
@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 @@ class StandardCommonCommands(CommandContainer):
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 @@ class StandardCommonCommands(CommandContainer):
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 @@ class StandardCommonCommands(CommandContainer):
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 @@ class StandardCommonCommands(CommandContainer):
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 @@ class StandardCommonChatCommands(CommandContainer):
@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 @@ class StandardGroupChatCommands(CommandContainer):
@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 @@ class StandardGroupChatCommands(CommandContainer):
@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 @@ class StandardGroupChatCommands(CommandContainer):
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 @@ class StandardGroupChatCommands(CommandContainer):
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 @@ class StandardGroupChatCommands(CommandContainer):
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 @@ class StandardGroupChatCommands(CommandContainer):
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 @@ class StandardGroupChatCommands(CommandContainer):
@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)
# -*- 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>
......@@ -144,7 +144,7 @@ SHOW_LIST = ['offline', 'connecting', 'online', 'chat', 'away', 'xa', 'dnd',
# 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
......
......@@ -27,7 +27,7 @@ import os
import shutil
import sys
from gajim.common import gajim
from gajim.common import app
from gajim.common import logger
# DO NOT MOVE ABOVE OF import gajim
......@@ -173,12 +173,12 @@ 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
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']
......@@ -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,8 +262,8 @@ 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
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']
......@@ -271,7 +271,7 @@ def check_and_possibly_create_paths():
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'))
......
......@@ -25,7 +25,7 @@
import nbxmpp
from gajim.common import helpers
from gajim.common import dataforms
from gajim.common import gajim
from gajim.common import app
from gajim.common.connection_handlers_events import MessageOutgoingEvent
import logging
......@@ -157,7 +157,7 @@ class ChangeStatusCommand(AdHocCommand):
self.connection.connection.send(response, now = presencetype == 'offline')
# send new status
gajim.interface.roster.send_status(self.connection.name, presencetype,
app.interface.roster.send_status(self.connection.name, presencetype,
presencedesc)
return False # finish the session
......@@ -165,8 +165,8 @@ class ChangeStatusCommand(AdHocCommand):
def find_current_groupchats(account):
import message_control
rooms = []
for gc_control in gajim.interface.msg_win_mgr.get_controls(
message_control.TYPE_GC) + gajim.interface.minimized_controls[account].\
for gc_control in app.interface.msg_win_mgr.get_controls(
message_control.TYPE_GC) + app.interface.minimized_controls[account].\
values():
acct = gc_control.account
# check if account is the good one
......@@ -174,8 +174,8 @@ def find_current_groupchats(account):
continue
room_jid = gc_control.room_jid
nick = gc_control.nick
if room_jid in gajim.gc_connected[acct] and \
gajim.gc_connected[acct][room_jid]:
if room_jid in app.gc_connected[acct] and \
app.gc_connected[acct][room_jid]:
rooms.append((room_jid, nick,))
return rooms
......@@ -241,13 +241,13 @@ class LeaveGroupchatsCommand(AdHocCommand):
account = self.connection.name
try:
for room_jid in gc:
gc_control = gajim.interface.msg_win_mgr.get_gc_control(room_jid,
gc_control = app.interface.msg_win_mgr.get_gc_control(room_jid,
account)
if not gc_control:
gc_control = gajim.interface.minimized_controls[account]\
gc_control = app.interface.minimized_controls[account]\
[room_jid]
gc_control.shutdown()
gajim.interface.roster.remove_groupchat(room_jid, account)
app.interface.roster.remove_groupchat(room_jid, account)
continue
gc_control.parent_win.remove_tab(gc_control, None, force = True)
except Exception: # KeyError if there's no such room opened
......@@ -278,15 +278,15 @@ class ForwardMessagesCommand(AdHocCommand):
def execute(self, request):
account = self.connection.name
# Forward messages
events = gajim.events.get_events(account, types=['chat', 'normal',
events = app.events.get_events(account, types=['chat', 'normal',
'printed_chat'])
j, resource = gajim.get_room_and_nick_from_fjid(self.jid)
j, resource = app.get_room_and_nick_from_fjid(self.jid)
for jid in events:
for event in events[jid]:
ev_typ = event.type_
if ev_typ == 'printed_chat':
ev_typ = 'chat'
gajim.nec.push_outgoing_event(MessageOutgoingEvent(None,
app.nec.push_outgoing_event(MessageOutgoingEvent(None,
account=account, jid=j, message=event.message, type_=ev_typ,
subject=event.subject, resource=resource, forward_from=jid,
delayed=event.time_))
......@@ -313,14 +313,14 @@ class FwdMsgThenDisconnectCommand(AdHocCommand):
def execute(self, request):
account = self.connection.name
# Forward messages
events = gajim.events.get_events(account, types=['chat', 'normal'])
j, resource = gajim.get_room_and_nick_from_fjid(self.jid)
events = app.events.get_events(account, types=['chat', 'normal'])
j, resource = app.get_room_and_nick_from_fjid(self.jid)
for jid in events:
for event in events[jid]:
ev_typ = event.type_
if ev_typ == 'printed_chat':
ev_typ = 'chat'
gajim.nec.push_outgoing_event(MessageOutgoingEvent(None,
app.nec.push_outgoing_event(MessageOutgoingEvent(None,
account=account, jid=j, message=event.message, type_=ev_typ,
subject=event.subject, resource=resource, forward_from=jid,
delayed=event.time_, now=True))
......@@ -333,7 +333,7 @@ class FwdMsgThenDisconnectCommand(AdHocCommand):
self.connection.connection.send(response, now = True)
# send new status
gajim.interface.roster.send_status(self.connection.name, 'offline', '')
app.interface.roster.send_status(self.connection.name, 'offline', '')
# finish the session
return False
......@@ -345,7 +345,7 @@ class ConnectionCommands:
def __init__(self):
# a list of all commands exposed: node -> command class
self.__commands = {}
if gajim.config.get('remote_commands'):
if app.config.get('remote_commands'):
for cmdobj in (ChangeStatusCommand, ForwardMessagesCommand,
LeaveGroupchatsCommand, FwdMsgThenDisconnectCommand):
self.__commands[cmdobj.commandnode] = cmdobj
......@@ -354,7 +354,7 @@ class ConnectionCommands:
self.__sessions = {}
def getOurBareJID(self):
return gajim.get_jid_from_account(self.name)
return app.get_jid_from_account(self.name)
def isSameJID(self, jid):
"""
......
......@@ -795,9 +795,9 @@ class Config:
self.__options[1][opt] = self.__options[0][opt][Option.VAL]
def _really_save(self):
from gajim.common import gajim
if gajim.interface:
gajim.interface.save_config()
from gajim.common import app
if app.interface:
app.interface.save_config()
self.save_timeout_id = None
return False
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -165,8 +165,8 @@ class Contact(CommonContact):
return is_observer
def is_groupchat(self):
for account in common.gajim.gc_connected:
if self.jid in common.gajim.gc_connected[account]:
for account in common.app.gc_connected:
if self.jid in common.app.gc_connected[account]:
return True
return False
......@@ -258,8 +258,8 @@ class LegacyContactsAPI:
def create_self_contact(self, jid, account, resource, show, status, priority,
name='', keyID=''):
conn = common.gajim.connections[account]
nick = name or common.gajim.nicks[account]
conn = common.app.connections[account]
nick = name or common.app.nicks[account]
account = self._accounts.get(account, account) # Use Account object if available
self_contact = self.create_contact(jid=jid, account=account,
name=nick, groups=['self_contact'], show=show, status=status,
......@@ -357,11 +357,11 @@ class LegacyContactsAPI:
nbr_online = 0
nbr_total = 0
for account in accounts: