summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core.py10
-rw-r--r--src/events.py1
2 files changed, 9 insertions, 2 deletions
diff --git a/src/core.py b/src/core.py
index 6cd7b97b..b7e24c50 100644
--- a/src/core.py
+++ b/src/core.py
@@ -397,6 +397,7 @@ class Core(object):
resource = contact.get_resource_by_fulljid(jid.full)
assert not resource
resource = Resource(jid.full)
+ self.events.trigger('normal_presence', presence, resource)
status = presence['type']
status_message = presence['status']
priority = presence.getPriority() or 0
@@ -465,7 +466,9 @@ class Core(object):
# request the roster
self.xmpp.getRoster()
# send initial presence
- self.xmpp.makePresence().send()
+ pres = self.xmpp.make_presence()
+ self.events.trigger('send_normal_presence', pres)
+ pres.send()
rooms = config.get('rooms', '')
if rooms == '' or not isinstance(rooms, str):
return
@@ -1153,6 +1156,7 @@ class Core(object):
if msg:
pres['status'] = msg
pres['type'] = show
+ self.events.trigger('send_normal_presence', pres)
pres.send()
current = self.current_tab()
if isinstance(current, tabs.MucTab) and current.joined and show in ('away', 'xa'):
@@ -1194,7 +1198,9 @@ class Core(object):
if type == 'available':
type = None
try:
- self.xmpp.make_presence(pto=jid, ptype=type, pstatus=status).send()
+ pres = self.xmpp.make_presence(pto=jid, ptype=type, pstatus=status)
+ self.events.trigger('send_normal_presence', pres)
+ pres.send()
except :
import traceback
self.information(_('Could not send directed presence'), 'Error')
diff --git a/src/events.py b/src/events.py
index ee08936e..3a8e4d08 100644
--- a/src/events.py
+++ b/src/events.py
@@ -32,6 +32,7 @@ class EventHandler(object):
'private_chatstate': [],
'normal_presence': [],
'muc_presence': [],
+ 'send_normal_presence': [],
}
def add_event_handler(self, name, callback, position=0):