add a new event that is sent just before changing status. Fixes #7593
This commit is contained in:
parent
76d0f16d4a
commit
b9ff018a03
|
@ -708,12 +708,16 @@ class CommonConnection:
|
|||
if gajim.HAVE_GPG:
|
||||
self.USE_GPG = True
|
||||
self.gpg = gpg.GnuPG(gajim.config.get('use_gpg_agent'))
|
||||
gajim.nec.push_incoming_event(BeforeChangeShowEvent(None,
|
||||
conn=self, show=show, message=msg))
|
||||
self.connect_and_init(show, msg, sign_msg)
|
||||
return
|
||||
|
||||
if show == 'offline':
|
||||
self.connected = 0
|
||||
if self.connection:
|
||||
gajim.nec.push_incoming_event(BeforeChangeShowEvent(None,
|
||||
conn=self, show=show, message=msg))
|
||||
p = nbxmpp.Presence(typ = 'unavailable')
|
||||
p = self.add_sha(p, False)
|
||||
if msg:
|
||||
|
@ -731,12 +735,16 @@ class CommonConnection:
|
|||
if self.connected == 1:
|
||||
return
|
||||
if show == 'invisible':
|
||||
gajim.nec.push_incoming_event(BeforeChangeShowEvent(None,
|
||||
conn=self, show=show, message=msg))
|
||||
self._change_to_invisible(msg)
|
||||
return
|
||||
if show not in ['offline', 'online', 'chat', 'away', 'xa', 'dnd']:
|
||||
return -1
|
||||
was_invisible = self.connected == gajim.SHOW_LIST.index('invisible')
|
||||
self.connected = gajim.SHOW_LIST.index(show)
|
||||
gajim.nec.push_incoming_event(BeforeChangeShowEvent(None,
|
||||
conn=self, show=show, message=msg))
|
||||
if was_invisible:
|
||||
self._change_from_invisible()
|
||||
self._update_status(show, msg)
|
||||
|
|
|
@ -997,6 +997,10 @@ class OurShowEvent(nec.NetworkIncomingEvent):
|
|||
name = 'our-show'
|
||||
base_network_events = []
|
||||
|
||||
class BeforeChangeShowEvent(nec.NetworkIncomingEvent):
|
||||
name = 'before-change-show'
|
||||
base_network_events = []
|
||||
|
||||
class MessageReceivedEvent(nec.NetworkIncomingEvent, HelperEvent):
|
||||
name = 'message-received'
|
||||
base_network_events = ['raw-message-received']
|
||||
|
|
Loading…
Reference in New Issue