Remove unnecessary event classes
This commit is contained in:
parent
fcb33a10e7
commit
371756c2a5
|
@ -58,6 +58,7 @@ from gajim.common import app
|
||||||
from gajim.common import gpg
|
from gajim.common import gpg
|
||||||
from gajim.common import passwords
|
from gajim.common import passwords
|
||||||
from gajim.common import idle
|
from gajim.common import idle
|
||||||
|
from gajim.common.nec import NetworkEvent
|
||||||
from gajim.common.i18n import _
|
from gajim.common.i18n import _
|
||||||
from gajim.common.connection_handlers import *
|
from gajim.common.connection_handlers import *
|
||||||
from gajim.common.contacts import GC_Contact
|
from gajim.common.contacts import GC_Contact
|
||||||
|
@ -421,11 +422,15 @@ class CommonConnection:
|
||||||
def _event_dispatcher(self, realm, event, data):
|
def _event_dispatcher(self, realm, event, data):
|
||||||
if realm == '':
|
if realm == '':
|
||||||
if event == 'STANZA RECEIVED':
|
if event == 'STANZA RECEIVED':
|
||||||
app.nec.push_incoming_event(StanzaReceivedEvent(
|
app.nec.push_incoming_event(
|
||||||
None, conn=self, stanza_str=str(data)))
|
NetworkEvent('stanza-received',
|
||||||
|
conn=self,
|
||||||
|
stanza_str=str(data)))
|
||||||
elif event == 'DATA SENT':
|
elif event == 'DATA SENT':
|
||||||
app.nec.push_incoming_event(StanzaSentEvent(
|
app.nec.push_incoming_event(
|
||||||
None, conn=self, stanza_str=str(data)))
|
NetworkEvent('stanza-sent',
|
||||||
|
conn=self,
|
||||||
|
stanza_str=str(data)))
|
||||||
|
|
||||||
def change_status(self, show, msg, auto=False):
|
def change_status(self, show, msg, auto=False):
|
||||||
if not msg:
|
if not msg:
|
||||||
|
@ -732,8 +737,8 @@ class Connection(CommonConnection, ConnectionHandlers):
|
||||||
reason = _('Server %(name)s answered wrongly to '
|
reason = _('Server %(name)s answered wrongly to '
|
||||||
'register request: %(error)s') % {'name': data[0],
|
'register request: %(error)s') % {'name': data[0],
|
||||||
'error': data[3]}
|
'error': data[3]}
|
||||||
app.nec.push_incoming_event(AccountNotCreatedEvent(
|
app.nec.push_incoming_event(NetworkEvent(
|
||||||
None, conn=self, reason=reason))
|
'account-not-created', conn=self, reason=reason))
|
||||||
return
|
return
|
||||||
is_form = data[2]
|
is_form = data[2]
|
||||||
conf = data[1]
|
conf = data[1]
|
||||||
|
@ -743,15 +748,16 @@ class Connection(CommonConnection, ConnectionHandlers):
|
||||||
def _on_register_result(result):
|
def _on_register_result(result):
|
||||||
if not nbxmpp.isResultNode(result):
|
if not nbxmpp.isResultNode(result):
|
||||||
reason = result.getErrorMsg() or result.getError()
|
reason = result.getErrorMsg() or result.getError()
|
||||||
app.nec.push_incoming_event(AccountNotCreatedEvent(
|
app.nec.push_incoming_event(NetworkEvent(
|
||||||
None, conn=self, reason=reason))
|
'account-not-created', conn=self, reason=reason))
|
||||||
return
|
return
|
||||||
if app.is_installed('GPG'):
|
if app.is_installed('GPG'):
|
||||||
self.USE_GPG = True
|
self.USE_GPG = True
|
||||||
self.gpg = gpg.GnuPG()
|
self.gpg = gpg.GnuPG()
|
||||||
app.nec.push_incoming_event(
|
app.nec.push_incoming_event(
|
||||||
AccountCreatedEvent(None, conn=self,
|
NetworkEvent('account-created',
|
||||||
account_info=self.new_account_info))
|
conn=self,
|
||||||
|
account_info=self.new_account_info))
|
||||||
self.new_account_info = None
|
self.new_account_info = None
|
||||||
self.new_account_form = None
|
self.new_account_form = None
|
||||||
if self.connection:
|
if self.connection:
|
||||||
|
@ -773,8 +779,8 @@ class Connection(CommonConnection, ConnectionHandlers):
|
||||||
# requested config has changed since first connection
|
# requested config has changed since first connection
|
||||||
reason = _('Server %s provided a different '
|
reason = _('Server %s provided a different '
|
||||||
'registration form') % data[0]
|
'registration form') % data[0]
|
||||||
app.nec.push_incoming_event(AccountNotCreatedEvent(
|
app.nec.push_incoming_event(NetworkEvent(
|
||||||
None, conn=self, reason=reason))
|
'account-not-created', conn=self, reason=reason))
|
||||||
return
|
return
|
||||||
nbxmpp.features_nb.register(self.connection,
|
nbxmpp.features_nb.register(self.connection,
|
||||||
self._hostname, self.new_account_form,
|
self._hostname, self.new_account_form,
|
||||||
|
@ -1039,9 +1045,12 @@ class Connection(CommonConnection, ConnectionHandlers):
|
||||||
|
|
||||||
if self.client_cert and app.config.get_per('accounts', self.name,
|
if self.client_cert and app.config.get_per('accounts', self.name,
|
||||||
'client_cert_encrypted'):
|
'client_cert_encrypted'):
|
||||||
app.nec.push_incoming_event(ClientCertPassphraseEvent(
|
app.nec.push_incoming_event(
|
||||||
None, conn=self, con=con, port=port,
|
NetworkEvent('client-cert-passphrase',
|
||||||
secure_tuple=secure_tuple))
|
conn=self,
|
||||||
|
con=con,
|
||||||
|
port=port,
|
||||||
|
secure_tuple=secure_tuple))
|
||||||
return
|
return
|
||||||
self.on_client_cert_passphrase('', con, port, secure_tuple)
|
self.on_client_cert_passphrase('', con, port, secure_tuple)
|
||||||
|
|
||||||
|
@ -1115,8 +1124,10 @@ class Connection(CommonConnection, ConnectionHandlers):
|
||||||
con.RegisterDisconnectHandler(self.disconnect)
|
con.RegisterDisconnectHandler(self.disconnect)
|
||||||
if _con_type == 'plain' and app.config.get_per('accounts', self.name,
|
if _con_type == 'plain' and app.config.get_per('accounts', self.name,
|
||||||
'action_when_plaintext_connection') == 'warn':
|
'action_when_plaintext_connection') == 'warn':
|
||||||
app.nec.push_incoming_event(PlainConnectionEvent(None, conn=self,
|
app.nec.push_incoming_event(
|
||||||
xmpp_client=con))
|
NetworkEvent('plain-connection',
|
||||||
|
conn=self,
|
||||||
|
xmpp_client=con))
|
||||||
return True
|
return True
|
||||||
if _con_type == 'plain' and app.config.get_per('accounts', self.name,
|
if _con_type == 'plain' and app.config.get_per('accounts', self.name,
|
||||||
'action_when_plaintext_connection') == 'disconnect':
|
'action_when_plaintext_connection') == 'disconnect':
|
||||||
|
@ -1129,8 +1140,11 @@ class Connection(CommonConnection, ConnectionHandlers):
|
||||||
'warn_when_insecure_ssl_connection') and \
|
'warn_when_insecure_ssl_connection') and \
|
||||||
not self.connection_auto_accepted:
|
not self.connection_auto_accepted:
|
||||||
# Pyopenssl is not used
|
# Pyopenssl is not used
|
||||||
app.nec.push_incoming_event(InsecureSSLConnectionEvent(None,
|
app.nec.push_incoming_event(
|
||||||
conn=self, xmpp_client=con, conn_type=_con_type))
|
NetworkEvent('insecure-ssl-connection',
|
||||||
|
conn=self,
|
||||||
|
xmpp_client=con,
|
||||||
|
conn_type=_con_type))
|
||||||
return True
|
return True
|
||||||
return self.connection_accepted(con, con_type)
|
return self.connection_accepted(con, con_type)
|
||||||
|
|
||||||
|
@ -1187,9 +1201,11 @@ class Connection(CommonConnection, ConnectionHandlers):
|
||||||
self.process_ssl_errors()
|
self.process_ssl_errors()
|
||||||
return
|
return
|
||||||
|
|
||||||
app.nec.push_incoming_event(SSLErrorEvent(None, conn=self,
|
app.nec.push_incoming_event(
|
||||||
error_num=errnum,
|
NetworkEvent('ssl-error',
|
||||||
cert=cert))
|
conn=self,
|
||||||
|
error_num=errnum,
|
||||||
|
cert=cert))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _calculate_cert_sha256(cert):
|
def _calculate_cert_sha256(cert):
|
||||||
|
@ -1286,8 +1302,8 @@ class Connection(CommonConnection, ConnectionHandlers):
|
||||||
if self.password is not None:
|
if self.password is not None:
|
||||||
on_password(self.password)
|
on_password(self.password)
|
||||||
else:
|
else:
|
||||||
app.nec.push_incoming_event(PasswordRequiredEvent(
|
app.nec.push_incoming_event(NetworkEvent(
|
||||||
None, conn=self, on_password=on_password))
|
'password-required', conn=self, on_password=on_password))
|
||||||
|
|
||||||
def _auth(self):
|
def _auth(self):
|
||||||
self._register_handlers(self.connection, self._current_type)
|
self._register_handlers(self.connection, self._current_type)
|
||||||
|
@ -1311,7 +1327,9 @@ class Connection(CommonConnection, ConnectionHandlers):
|
||||||
app.con_types[self.name] = con_type
|
app.con_types[self.name] = con_type
|
||||||
# notify the gui about con_type
|
# notify the gui about con_type
|
||||||
app.nec.push_incoming_event(
|
app.nec.push_incoming_event(
|
||||||
ConnectionTypeEvent(None, conn=self, connection_type=con_type))
|
NetworkEvent('connection-type',
|
||||||
|
conn=self,
|
||||||
|
connection_type=con_type))
|
||||||
ConnectionHandlers._register_handlers(self, con, con_type)
|
ConnectionHandlers._register_handlers(self, con, con_type)
|
||||||
|
|
||||||
def _on_auth_successful(self):
|
def _on_auth_successful(self):
|
||||||
|
@ -1365,8 +1383,11 @@ class Connection(CommonConnection, ConnectionHandlers):
|
||||||
app.config.set_per('accounts', self.name,
|
app.config.set_per('accounts', self.name,
|
||||||
'name', self.connection.User)
|
'name', self.connection.User)
|
||||||
new_jid = app.get_jid_from_account(self.name)
|
new_jid = app.get_jid_from_account(self.name)
|
||||||
app.nec.push_incoming_event(AnonymousAuthEvent(
|
app.nec.push_incoming_event(
|
||||||
None, conn=self, old_jid=old_jid, new_jid=new_jid))
|
NetworkEvent('anonymous-auth',
|
||||||
|
conn=self,
|
||||||
|
old_jid=old_jid,
|
||||||
|
new_jid=new_jid))
|
||||||
|
|
||||||
self.connected = 2
|
self.connected = 2
|
||||||
self.retrycount = 0
|
self.retrycount = 0
|
||||||
|
@ -1447,7 +1468,7 @@ class Connection(CommonConnection, ConnectionHandlers):
|
||||||
self.get_module('Blocking').get_blocking_list()
|
self.get_module('Blocking').get_blocking_list()
|
||||||
|
|
||||||
# Inform GUI we just signed in
|
# Inform GUI we just signed in
|
||||||
app.nec.push_incoming_event(SignedInEvent(None, conn=self))
|
app.nec.push_incoming_event(NetworkEvent('signed-in', conn=self))
|
||||||
|
|
||||||
def get_signed_presence(self, msg, callback=None):
|
def get_signed_presence(self, msg, callback=None):
|
||||||
if app.config.get_per('accounts', self.name, 'gpg_sign_presence'):
|
if app.config.get_per('accounts', self.name, 'gpg_sign_presence'):
|
||||||
|
|
|
@ -34,6 +34,7 @@ from gajim.common import ged
|
||||||
from gajim.common import helpers
|
from gajim.common import helpers
|
||||||
from gajim.common import jingle_xtls
|
from gajim.common import jingle_xtls
|
||||||
from gajim.common import modules
|
from gajim.common import modules
|
||||||
|
from gajim.common.nec import NetworkEvent
|
||||||
from gajim.common.caps_cache import muc_caps_cache
|
from gajim.common.caps_cache import muc_caps_cache
|
||||||
from gajim.common.connection_handlers_events import *
|
from gajim.common.connection_handlers_events import *
|
||||||
from gajim.common.const import KindConstant
|
from gajim.common.const import KindConstant
|
||||||
|
@ -360,7 +361,7 @@ class ConnectionHandlers(ConnectionSocks5Bytestream,
|
||||||
self.get_module('Blocking').get_blocking_list()
|
self.get_module('Blocking').get_blocking_list()
|
||||||
|
|
||||||
# Inform GUI we just signed in
|
# Inform GUI we just signed in
|
||||||
app.nec.push_incoming_event(SignedInEvent(None, conn=self))
|
app.nec.push_incoming_event(NetworkEvent('signed-in', conn=self))
|
||||||
self.get_module('PEP').send_stored_publish()
|
self.get_module('PEP').send_stored_publish()
|
||||||
self.continue_connect_info = None
|
self.continue_connect_info = None
|
||||||
|
|
||||||
|
|
|
@ -66,9 +66,6 @@ class MessageSentEvent(nec.NetworkIncomingEvent):
|
||||||
self.conn.sent_message_ids = self.conn.sent_message_ids[-20000:]
|
self.conn.sent_message_ids = self.conn.sent_message_ids[-20000:]
|
||||||
return True
|
return True
|
||||||
|
|
||||||
class MessageNotSentEvent(nec.NetworkIncomingEvent):
|
|
||||||
name = 'message-not-sent'
|
|
||||||
|
|
||||||
class MessageErrorEvent(nec.NetworkIncomingEvent):
|
class MessageErrorEvent(nec.NetworkIncomingEvent):
|
||||||
name = 'message-error'
|
name = 'message-error'
|
||||||
|
|
||||||
|
@ -85,9 +82,6 @@ class MessageErrorEvent(nec.NetworkIncomingEvent):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
class AnonymousAuthEvent(nec.NetworkIncomingEvent):
|
|
||||||
name = 'anonymous-auth'
|
|
||||||
|
|
||||||
class JingleRequestReceivedEvent(nec.NetworkIncomingEvent):
|
class JingleRequestReceivedEvent(nec.NetworkIncomingEvent):
|
||||||
name = 'jingle-request-received'
|
name = 'jingle-request-received'
|
||||||
|
|
||||||
|
@ -133,12 +127,6 @@ class JingleErrorReceivedEvent(nec.NetworkIncomingEvent):
|
||||||
self.sid = self.jingle_session.sid
|
self.sid = self.jingle_session.sid
|
||||||
return True
|
return True
|
||||||
|
|
||||||
class AccountCreatedEvent(nec.NetworkIncomingEvent):
|
|
||||||
name = 'account-created'
|
|
||||||
|
|
||||||
class AccountNotCreatedEvent(nec.NetworkIncomingEvent):
|
|
||||||
name = 'account-not-created'
|
|
||||||
|
|
||||||
class NewAccountConnectedEvent(nec.NetworkIncomingEvent):
|
class NewAccountConnectedEvent(nec.NetworkIncomingEvent):
|
||||||
name = 'new-account-connected'
|
name = 'new-account-connected'
|
||||||
|
|
||||||
|
@ -165,15 +153,6 @@ class NewAccountConnectedEvent(nec.NetworkIncomingEvent):
|
||||||
class NewAccountNotConnectedEvent(nec.NetworkIncomingEvent):
|
class NewAccountNotConnectedEvent(nec.NetworkIncomingEvent):
|
||||||
name = 'new-account-not-connected'
|
name = 'new-account-not-connected'
|
||||||
|
|
||||||
class ConnectionTypeEvent(nec.NetworkIncomingEvent):
|
|
||||||
name = 'connection-type'
|
|
||||||
|
|
||||||
class StanzaReceivedEvent(nec.NetworkIncomingEvent):
|
|
||||||
name = 'stanza-received'
|
|
||||||
|
|
||||||
class StanzaSentEvent(nec.NetworkIncomingEvent):
|
|
||||||
name = 'stanza-sent'
|
|
||||||
|
|
||||||
class BadGPGPassphraseEvent(nec.NetworkIncomingEvent):
|
class BadGPGPassphraseEvent(nec.NetworkIncomingEvent):
|
||||||
name = 'bad-gpg-passphrase'
|
name = 'bad-gpg-passphrase'
|
||||||
|
|
||||||
|
@ -191,9 +170,6 @@ class ConnectionLostEvent(nec.NetworkIncomingEvent):
|
||||||
show='offline'))
|
show='offline'))
|
||||||
return True
|
return True
|
||||||
|
|
||||||
class GPGTrustKeyEvent(nec.NetworkIncomingEvent):
|
|
||||||
name = 'gpg-trust-key'
|
|
||||||
|
|
||||||
class GPGPasswordRequiredEvent(nec.NetworkIncomingEvent):
|
class GPGPasswordRequiredEvent(nec.NetworkIncomingEvent):
|
||||||
name = 'gpg-password-required'
|
name = 'gpg-password-required'
|
||||||
|
|
||||||
|
@ -201,42 +177,6 @@ class GPGPasswordRequiredEvent(nec.NetworkIncomingEvent):
|
||||||
self.keyid = app.config.get_per('accounts', self.conn.name, 'keyid')
|
self.keyid = app.config.get_per('accounts', self.conn.name, 'keyid')
|
||||||
return True
|
return True
|
||||||
|
|
||||||
class PlainConnectionEvent(nec.NetworkIncomingEvent):
|
|
||||||
name = 'plain-connection'
|
|
||||||
|
|
||||||
class InsecureSSLConnectionEvent(nec.NetworkIncomingEvent):
|
|
||||||
name = 'insecure-ssl-connection'
|
|
||||||
|
|
||||||
class SSLErrorEvent(nec.NetworkIncomingEvent):
|
|
||||||
name = 'ssl-error'
|
|
||||||
|
|
||||||
class UpdateGCAvatarEvent(nec.NetworkIncomingEvent):
|
|
||||||
name = 'update-gc-avatar'
|
|
||||||
|
|
||||||
def generate(self):
|
|
||||||
return True
|
|
||||||
|
|
||||||
class UpdateRosterAvatarEvent(nec.NetworkIncomingEvent):
|
|
||||||
name = 'update-roster-avatar'
|
|
||||||
|
|
||||||
def generate(self):
|
|
||||||
return True
|
|
||||||
|
|
||||||
class UpdateRoomAvatarEvent(nec.NetworkIncomingEvent):
|
|
||||||
name = 'update-room-avatar'
|
|
||||||
|
|
||||||
def generate(self):
|
|
||||||
return True
|
|
||||||
|
|
||||||
class ZeroconfNameConflictEvent(nec.NetworkIncomingEvent):
|
|
||||||
name = 'zeroconf-name-conflict'
|
|
||||||
|
|
||||||
class PasswordRequiredEvent(nec.NetworkIncomingEvent):
|
|
||||||
name = 'password-required'
|
|
||||||
|
|
||||||
class SignedInEvent(nec.NetworkIncomingEvent):
|
|
||||||
name = 'signed-in'
|
|
||||||
|
|
||||||
class FileRequestReceivedEvent(nec.NetworkIncomingEvent):
|
class FileRequestReceivedEvent(nec.NetworkIncomingEvent):
|
||||||
name = 'file-request-received'
|
name = 'file-request-received'
|
||||||
|
|
||||||
|
@ -737,10 +677,6 @@ class GcMessageOutgoingEvent(nec.NetworkOutgoingEvent):
|
||||||
def generate(self):
|
def generate(self):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class ClientCertPassphraseEvent(nec.NetworkIncomingEvent):
|
|
||||||
name = 'client-cert-passphrase'
|
|
||||||
|
|
||||||
class InformationEvent(nec.NetworkIncomingEvent):
|
class InformationEvent(nec.NetworkIncomingEvent):
|
||||||
name = 'information'
|
name = 'information'
|
||||||
|
|
||||||
|
@ -756,10 +692,3 @@ class InformationEvent(nec.NetworkIncomingEvent):
|
||||||
else:
|
else:
|
||||||
self.args = (self.args,)
|
self.args = (self.args,)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class StyleChanged(nec.NetworkIncomingEvent):
|
|
||||||
name = 'style-changed'
|
|
||||||
|
|
||||||
def generate(self):
|
|
||||||
return True
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ from gi.repository import GLib
|
||||||
from gajim.common import app
|
from gajim.common import app
|
||||||
from gajim.common import ged
|
from gajim.common import ged
|
||||||
from gajim.common import modules
|
from gajim.common import modules
|
||||||
|
from gajim.common.nec import NetworkEvent
|
||||||
from gajim.common.i18n import _
|
from gajim.common.i18n import _
|
||||||
from gajim.common.connection import CommonConnection
|
from gajim.common.connection import CommonConnection
|
||||||
from gajim.common.zeroconf import client_zeroconf
|
from gajim.common.zeroconf import client_zeroconf
|
||||||
|
@ -240,8 +241,10 @@ class ConnectionZeroconf(CommonConnection, ConnectionHandlersZeroconf):
|
||||||
self.disconnect()
|
self.disconnect()
|
||||||
app.nec.push_incoming_event(OurShowEvent(None, conn=self,
|
app.nec.push_incoming_event(OurShowEvent(None, conn=self,
|
||||||
show='offline'))
|
show='offline'))
|
||||||
app.nec.push_incoming_event(ZeroconfNameConflictEvent(None, conn=self,
|
app.nec.push_incoming_event(
|
||||||
alt_name=alt_name))
|
NetworkEvent('zeroconf-name-conflict',
|
||||||
|
conn=self,
|
||||||
|
alt_name=alt_name))
|
||||||
|
|
||||||
def _on_error(self, message):
|
def _on_error(self, message):
|
||||||
app.nec.push_incoming_event(InformationEvent(
|
app.nec.push_incoming_event(InformationEvent(
|
||||||
|
@ -362,7 +365,7 @@ class ConnectionZeroconf(CommonConnection, ConnectionHandlersZeroconf):
|
||||||
check = self.connection.announce()
|
check = self.connection.announce()
|
||||||
else:
|
else:
|
||||||
self.connected = STATUS_LIST.index(show)
|
self.connected = STATUS_LIST.index(show)
|
||||||
app.nec.push_incoming_event(SignedInEvent(None, conn=self))
|
app.nec.push_incoming_event(NetworkEvent('signed-in', conn=self))
|
||||||
|
|
||||||
# stay offline when zeroconf does something wrong
|
# stay offline when zeroconf does something wrong
|
||||||
if check:
|
if check:
|
||||||
|
|
|
@ -21,11 +21,11 @@ from gi.repository import Gtk
|
||||||
from gi.repository import Gdk
|
from gi.repository import Gdk
|
||||||
|
|
||||||
from gajim.common import app
|
from gajim.common import app
|
||||||
|
from gajim.common.nec import NetworkEvent
|
||||||
from gajim.common.i18n import _
|
from gajim.common.i18n import _
|
||||||
from gajim.common.const import StyleAttr
|
from gajim.common.const import StyleAttr
|
||||||
from gajim.common.const import DialogButton
|
from gajim.common.const import DialogButton
|
||||||
from gajim.common.const import ButtonAction
|
from gajim.common.const import ButtonAction
|
||||||
from gajim.common.connection_handlers_events import StyleChanged
|
|
||||||
|
|
||||||
from gajim.gtk.dialogs import ErrorDialog
|
from gajim.gtk.dialogs import ErrorDialog
|
||||||
from gajim.gtk.dialogs import NewConfirmationDialog
|
from gajim.gtk.dialogs import NewConfirmationDialog
|
||||||
|
@ -388,18 +388,18 @@ class Option(Gtk.ListBoxRow):
|
||||||
color_string = color.to_string()
|
color_string = color.to_string()
|
||||||
app.css_config.set_value(
|
app.css_config.set_value(
|
||||||
self._option.selector, self._option.attr, color_string, pre=True)
|
self._option.selector, self._option.attr, color_string, pre=True)
|
||||||
app.nec.push_incoming_event(StyleChanged(None))
|
app.nec.push_incoming_event(NetworkEvent('style-changed'))
|
||||||
|
|
||||||
def _on_font_set(self, font_button):
|
def _on_font_set(self, font_button):
|
||||||
desc = font_button.get_font_desc()
|
desc = font_button.get_font_desc()
|
||||||
app.css_config.set_font(self._option.selector, desc, pre=True)
|
app.css_config.set_font(self._option.selector, desc, pre=True)
|
||||||
app.nec.push_incoming_event(StyleChanged(None,))
|
app.nec.push_incoming_event(NetworkEvent('style-changed'))
|
||||||
|
|
||||||
def _on_remove(self, *args):
|
def _on_remove(self, *args):
|
||||||
self.get_parent().remove(self)
|
self.get_parent().remove(self)
|
||||||
app.css_config.remove_value(
|
app.css_config.remove_value(
|
||||||
self._option.selector, self._option.attr, pre=True)
|
self._option.selector, self._option.attr, pre=True)
|
||||||
app.nec.push_incoming_event(StyleChanged(None))
|
app.nec.push_incoming_event(NetworkEvent('style-changed'))
|
||||||
self.destroy()
|
self.destroy()
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
|
|
|
@ -85,10 +85,10 @@ from gajim.common import socks5
|
||||||
from gajim.common import helpers
|
from gajim.common import helpers
|
||||||
from gajim.common import passwords
|
from gajim.common import passwords
|
||||||
from gajim.common import logging_helpers
|
from gajim.common import logging_helpers
|
||||||
|
from gajim.common.nec import NetworkEvent
|
||||||
from gajim.common.i18n import _
|
from gajim.common.i18n import _
|
||||||
from gajim.common.connection_handlers_events import (
|
from gajim.common.connection_handlers_events import (
|
||||||
OurShowEvent, FileTransferCompletedEvent,
|
OurShowEvent, FileTransferCompletedEvent)
|
||||||
UpdateRosterAvatarEvent, UpdateGCAvatarEvent, UpdateRoomAvatarEvent)
|
|
||||||
|
|
||||||
from gajim.common.modules.httpupload import HTTPUploadProgressEvent
|
from gajim.common.modules.httpupload import HTTPUploadProgressEvent
|
||||||
from gajim.common.connection import Connection
|
from gajim.common.connection import Connection
|
||||||
|
@ -614,22 +614,6 @@ class Interface:
|
||||||
self.gpg_passphrase[obj.keyid] = request
|
self.gpg_passphrase[obj.keyid] = request
|
||||||
request.add_callback(obj.conn.name, obj.callback)
|
request.add_callback(obj.conn.name, obj.callback)
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def handle_event_gpg_trust_key(obj):
|
|
||||||
#('GPG_ALWAYS_TRUST', account, callback)
|
|
||||||
def on_yes(checked):
|
|
||||||
if checked:
|
|
||||||
obj.conn.gpg.always_trust.append(obj.keyID)
|
|
||||||
obj.callback(True)
|
|
||||||
|
|
||||||
def on_no():
|
|
||||||
obj.callback(False)
|
|
||||||
|
|
||||||
YesNoDialog(_('Untrusted OpenPGP key'), _('The OpenPGP key '
|
|
||||||
'used to encrypt this chat is not trusted. Do you really want to '
|
|
||||||
'encrypt this message?'), checktext=_('_Do not ask me again'),
|
|
||||||
on_response_yes=on_yes, on_response_no=on_no)
|
|
||||||
|
|
||||||
def handle_event_password_required(self, obj):
|
def handle_event_password_required(self, obj):
|
||||||
#('PASSWORD_REQUIRED', account, None)
|
#('PASSWORD_REQUIRED', account, None)
|
||||||
account = obj.conn.name
|
account = obj.conn.name
|
||||||
|
@ -1359,7 +1343,6 @@ class Interface:
|
||||||
'muc-invitation': [self.handle_event_gc_invitation],
|
'muc-invitation': [self.handle_event_gc_invitation],
|
||||||
'muc-decline': [self.handle_event_gc_decline],
|
'muc-decline': [self.handle_event_gc_decline],
|
||||||
'gpg-password-required': [self.handle_event_gpg_password_required],
|
'gpg-password-required': [self.handle_event_gpg_password_required],
|
||||||
'gpg-trust-key': [self.handle_event_gpg_trust_key],
|
|
||||||
'http-auth-received': [self.handle_event_http_auth],
|
'http-auth-received': [self.handle_event_http_auth],
|
||||||
'information': [self.handle_event_information],
|
'information': [self.handle_event_information],
|
||||||
'insecure-ssl-connection': \
|
'insecure-ssl-connection': \
|
||||||
|
@ -2116,13 +2099,13 @@ class Interface:
|
||||||
def update_avatar(account=None, jid=None, contact=None, room_avatar=False):
|
def update_avatar(account=None, jid=None, contact=None, room_avatar=False):
|
||||||
if room_avatar:
|
if room_avatar:
|
||||||
app.nec.push_incoming_event(
|
app.nec.push_incoming_event(
|
||||||
UpdateRoomAvatarEvent(None, account=account, jid=jid))
|
NetworkEvent('update-room-avatar', account=account, jid=jid))
|
||||||
elif contact is None:
|
elif contact is None:
|
||||||
app.nec.push_incoming_event(
|
app.nec.push_incoming_event(
|
||||||
UpdateRosterAvatarEvent(None, account=account, jid=jid))
|
NetworkEvent('update-roster-avatar', account=account, jid=jid))
|
||||||
else:
|
else:
|
||||||
app.nec.push_incoming_event(
|
app.nec.push_incoming_event(
|
||||||
UpdateGCAvatarEvent(None, contact=contact))
|
NetworkEvent('update-gc-avatar', contact=contact))
|
||||||
|
|
||||||
def save_avatar(self, data, publish=False):
|
def save_avatar(self, data, publish=False):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue