aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/msn
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/msn')
-rw-r--r--protocols/msn/msn.c10
-rw-r--r--protocols/msn/ns.c14
2 files changed, 18 insertions, 6 deletions
diff --git a/protocols/msn/msn.c b/protocols/msn/msn.c
index 4acff23a..c5567a14 100644
--- a/protocols/msn/msn.c
+++ b/protocols/msn/msn.c
@@ -45,7 +45,11 @@ static void msn_init(account_t *acc)
s = set_add(&acc->set, "port", MSN_NS_PORT, set_eval_int, acc);
s->flags |= ACC_SET_OFFLINE_ONLY;
- set_add(&acc->set, "mail_notifications", "false", set_eval_bool, acc);
+ s = set_add(&acc->set, "mail_notifications", "false", set_eval_bool, acc);
+ s->flags |= ACC_SET_OFFLINE_ONLY;
+
+ s = set_add(&acc->set, "notify_handle", NULL, NULL, acc);
+ s->flags |= ACC_SET_OFFLINE_ONLY | SET_NULL_OK;
acc->flags |= ACC_FLAG_AWAY_MESSAGE | ACC_FLAG_STATUS_MESSAGE |
ACC_FLAG_HANDLE_DOMAINS;
@@ -81,6 +85,10 @@ static void msn_login(account_t *acc)
imcb_log(ic, "Connecting");
msn_ns_connect(ic, server,
set_getint(&ic->acc->set, "port"));
+
+ if (set_getbool(&acc->set, "mail_notifications") && set_getstr(&acc->set, "notify_handle")) {
+ imcb_add_buddy(ic, set_getstr(&acc->set, "notify_handle"), NULL);
+ }
}
static void msn_logout(struct im_connection *ic)
diff --git a/protocols/msn/ns.c b/protocols/msn/ns.c
index ab92f30d..130f1c91 100644
--- a/protocols/msn/ns.c
+++ b/protocols/msn/ns.c
@@ -393,9 +393,11 @@ int msn_ns_message(struct msn_data *md, char *msg, int msglen, char **cmd, int n
char *folders = get_rfc822_header(body, "Folders-Unread:", blen);
if (inbox && folders) {
- imcb_log(ic,
- "INBOX contains %s new messages, plus %s messages in other folders.", inbox,
- folders);
+ char *msg = g_strdup_printf(
+ "INBOX contains %s new messages, plus %s messages in other folders.", inbox,
+ folders);
+ imcb_notify_email(ic, set_getstr(&ic->acc->set, "notify_handle"), msg, 0, 0);
+ g_free(msg);
}
g_free(inbox);
@@ -407,8 +409,10 @@ int msn_ns_message(struct msn_data *md, char *msg, int msglen, char **cmd, int n
char *fromname = get_rfc822_header(body, "From:", blen);
if (from && fromname) {
- imcb_log(ic, "Received an e-mail message from %s <%s>.", fromname,
- from);
+ char *msg = g_strdup_printf("Received an e-mail message from %s <%s>.",
+ fromname, from);
+ imcb_notify_email(ic, set_getstr(&ic->acc->set, "notify_handle"), msg, 0, 0);
+ g_free(msg);
}
g_free(from);