# HG changeset patch # User Jeffrey Connelly # Date 1184543172 0 # Node ID 2bf10f37fa375f9e16400fbd6b810ecd58ad45ef # Parent 81a1f0c60a8d2e3602579c246a64da94d6899ad7 Use the much nicer purple_notify_emails() API to notify of new inbox messages, instead of purple_notify_formatted(). diff -r 81a1f0c60a8d -r 2bf10f37fa37 libpurple/protocols/myspace/myspace.c --- a/libpurple/protocols/myspace/myspace.c Sun Jul 15 23:44:37 2007 +0000 +++ b/libpurple/protocols/myspace/myspace.c Sun Jul 15 23:46:12 2007 +0000 @@ -1739,7 +1739,8 @@ gchar *body_str; GString *notification; guint old_inbox_status; - guint i; + guint i, n; + const gchar *froms[5], *tos[5], *urls[5], *subjects[5]; /* Three parallel arrays for each new inbox message type. */ static const gchar *inbox_keys[] = @@ -1792,6 +1793,8 @@ old_inbox_status = session->inbox_status; + n = 0; + for (i = 0; i < sizeof(inbox_keys) / sizeof(inbox_keys[0]); ++i) { const gchar *key; @@ -1806,35 +1809,36 @@ * (edge triggered) */ if (!(session->inbox_status & bit)) { - gchar *str; - - str = g_strdup_printf( - "

%s
\n", - inbox_urls[i], inbox_text[i]); - - g_string_append(notification, str); - - g_free(str); + purple_debug_info("msim", "msim_check_inbox_cb: got %s, at %d\n", + key, n); + + subjects[n] = inbox_text[i]; + froms[n] = _("MySpace"); + tos[n] = session->username; + /* TODO: append token, web challenge, so automatically logs in. + * Would also need to free strings because they won't be static + */ + urls[n] = inbox_urls[i]; + + ++n; } else { purple_debug_info("msim", "msim_check_inbox_cb: already notified of %s\n", key); - /* TODO: some kind of non-intrusitive notification? */ } session->inbox_status |= bit; } } - if (notification->len) + if (n) { purple_debug_info("msim", - "msim_check_inbox_cb: notifying %s\n", notification->str); - - purple_notify_formatted(session->account, - _("New Inbox Messages"), _("New Inbox Messages"), NULL, - notification->str, - NULL, NULL); + "msim_check_inbox_cb: notifying of %d\n", n); + + /* TODO: free strings with callback _if_ change to dynamic (w/ token) */ + purple_notify_emails(session->account, + n, TRUE, subjects, froms, tos, urls, NULL, NULL); }