summaryrefslogtreecommitdiff
path: root/modules/presence/notifier.c
diff options
context:
space:
mode:
Diffstat (limited to 'modules/presence/notifier.c')
-rw-r--r--modules/presence/notifier.c43
1 files changed, 3 insertions, 40 deletions
diff --git a/modules/presence/notifier.c b/modules/presence/notifier.c
index ced7b75..f9b7c67 100644
--- a/modules/presence/notifier.c
+++ b/modules/presence/notifier.c
@@ -22,7 +22,6 @@ struct notifier {
struct ua *ua;
};
-static enum presence_status my_status = PRESENCE_OPEN;
static struct list notifierl;
static struct sipevent_sock *evsock;
@@ -184,52 +183,19 @@ static int notifier_add(struct sipevent_sock *sock, const struct sip_msg *msg,
}
-static void notifier_update_status(enum presence_status status)
+void notifier_update_status(void)
{
struct le *le;
- if (status == my_status)
- return;
-
- info("presence: update my status from '%s' to '%s'\n",
- contact_presence_str(my_status),
- contact_presence_str(status));
-
- my_status = status;
-
for (le = notifierl.head; le; le = le->next) {
struct notifier *not = le->data;
- (void)notify(not, status);
+ (void)notify(not, my_status);
}
}
-static int cmd_online(struct re_printf *pf, void *arg)
-{
- (void)pf;
- (void)arg;
- notifier_update_status(PRESENCE_OPEN);
- return 0;
-}
-
-
-static int cmd_offline(struct re_printf *pf, void *arg)
-{
- (void)pf;
- (void)arg;
- notifier_update_status(PRESENCE_CLOSED);
- return 0;
-}
-
-
-static const struct cmd cmdv[] = {
- {'[', 0, "Set presence online", cmd_online },
- {']', 0, "Set presence offline", cmd_offline },
-};
-
-
static bool sub_handler(const struct sip_msg *msg, void *arg)
{
struct ua *ua;
@@ -255,16 +221,13 @@ int notifier_init(void)
int err;
err = sipevent_listen(&evsock, uag_sip(), 32, 32, sub_handler, NULL);
- if (err)
- return err;
- return cmd_register(cmdv, ARRAY_SIZE(cmdv));
+ return err;
}
void notifier_close(void)
{
- cmd_unregister(cmdv);
list_flush(&notifierl);
evsock = mem_deref(evsock);
}