Mercurial > pidgin.yaz
diff libpurple/notify.c @ 23113:8c3444f04709
propagate from branch 'im.pidgin.pidgin' (head d7144f5dbbde09137aff1ceadfd419e25303bf7d)
to branch 'im.pidgin.pidgin.next.minor' (head b6f1c6f279a87ac4b59426eea116c349eb31fe8c)
author | Evan Schoenberg <evan.s@dreskin.net> |
---|---|
date | Wed, 07 May 2008 12:14:28 +0000 |
parents | 5e6b42e77fb7 |
children | 84693a70ea3a 1dd0e007514d |
line wrap: on
line diff
--- a/libpurple/notify.c Mon May 05 06:55:00 2008 +0000 +++ b/libpurple/notify.c Wed May 07 12:14:28 2008 +0000 @@ -66,35 +66,27 @@ ops = purple_notify_get_ui_ops(); if (ops != NULL && ops->notify_message != NULL) { - PurpleNotifyInfo *info; + void *ui_handle = ops->notify_message(type, title, primary, + secondary); + if (ui_handle != NULL) { - info = g_new0(PurpleNotifyInfo, 1); - info->type = PURPLE_NOTIFY_MESSAGE; - info->handle = handle; - info->ui_handle = ops->notify_message(type, title, primary, - secondary); - info->cb = cb; - info->cb_user_data = user_data; + PurpleNotifyInfo *info = g_new0(PurpleNotifyInfo, 1); + info->type = PURPLE_NOTIFY_MESSAGE; + info->handle = handle; + info->ui_handle = ui_handle; + info->cb = cb; + info->cb_user_data = user_data; - if (info->ui_handle != NULL) { handles = g_list_append(handles, info); return info->ui_handle; - - } else { - if (info->cb != NULL) - info->cb(info->cb_user_data); - - g_free(info); - - return NULL; } - } else { - if (cb != NULL) - cb(user_data); } + if (cb != NULL) + cb(user_data); + return NULL; } @@ -108,36 +100,30 @@ ops = purple_notify_get_ui_ops(); if (ops != NULL && ops->notify_email != NULL) { - PurpleNotifyInfo *info; - - info = g_new0(PurpleNotifyInfo, 1); - info->type = PURPLE_NOTIFY_EMAIL; - info->handle = handle; + void *ui_handle; purple_signal_emit(purple_notify_get_handle(), "displaying-email-notification", - subject, from, to, url); + subject, from, to, url); + + ui_handle = ops->notify_email(handle, subject, from, to, url); + + if (ui_handle != NULL) { - info->ui_handle = ops->notify_email(handle, subject, from, to, url); - info->cb = cb; - info->cb_user_data = user_data; + PurpleNotifyInfo *info = g_new0(PurpleNotifyInfo, 1); + info->type = PURPLE_NOTIFY_EMAIL; + info->handle = handle; + info->ui_handle = ui_handle; + info->cb = cb; + info->cb_user_data = user_data; - if (info->ui_handle != NULL) { handles = g_list_append(handles, info); return info->ui_handle; - - } else { - if (info->cb != NULL) - info->cb(info->cb_user_data); - - g_free(info); + } + } - return NULL; - } - } else { - if (cb != NULL) - cb(user_data); - } + if (cb != NULL) + cb(user_data); return NULL; } @@ -162,39 +148,32 @@ ops = purple_notify_get_ui_ops(); if (ops != NULL && ops->notify_emails != NULL) { - PurpleNotifyInfo *info; - - info = g_new0(PurpleNotifyInfo, 1); - info->type = PURPLE_NOTIFY_EMAILS; - info->handle = handle; + void *ui_handle; purple_signal_emit(purple_notify_get_handle(), "displaying-emails-notification", subjects, froms, tos, urls, count); - info->ui_handle = ops->notify_emails(handle, count, detailed, subjects, + ui_handle = ops->notify_emails(handle, count, detailed, subjects, froms, tos, urls); - info->cb = cb; - info->cb_user_data = user_data; - if (info->ui_handle != NULL) { + if (ui_handle != NULL) { + PurpleNotifyInfo *info = g_new0(PurpleNotifyInfo, 1); + info->type = PURPLE_NOTIFY_EMAILS; + info->handle = handle; + info->ui_handle = ui_handle; + info->cb = cb; + info->cb_user_data = user_data; + handles = g_list_append(handles, info); return info->ui_handle; - - } else { - if (info->cb != NULL) - info->cb(info->cb_user_data); - - g_free(info); - - return NULL; } - } else { - if (cb != NULL) - cb(user_data); } + if (cb != NULL) + cb(user_data); + return NULL; } @@ -210,34 +189,25 @@ ops = purple_notify_get_ui_ops(); if (ops != NULL && ops->notify_formatted != NULL) { - PurpleNotifyInfo *info; + void *ui_handle = ops->notify_formatted(title, primary, secondary, text); + + if (ui_handle != NULL) { - info = g_new0(PurpleNotifyInfo, 1); - info->type = PURPLE_NOTIFY_FORMATTED; - info->handle = handle; - info->ui_handle = ops->notify_formatted(title, primary, secondary, text); - info->cb = cb; - info->cb_user_data = user_data; + PurpleNotifyInfo *info = g_new0(PurpleNotifyInfo, 1); + info->type = PURPLE_NOTIFY_FORMATTED; + info->handle = handle; + info->ui_handle = ui_handle; + info->cb = cb; + info->cb_user_data = user_data; - if (info->ui_handle != NULL) { handles = g_list_append(handles, info); return info->ui_handle; - - } else { - if (info->cb != NULL) - info->cb(info->cb_user_data); - - g_free(info); - - return NULL; } - - } else { - if (cb != NULL) - cb(user_data); } + if (cb != NULL) + cb(user_data); return NULL; } @@ -252,34 +222,25 @@ ops = purple_notify_get_ui_ops(); if (ops != NULL && ops->notify_searchresults != NULL) { - PurpleNotifyInfo *info; + void *ui_handle = ops->notify_searchresults(gc, title, primary, + secondary, results, user_data); + if (ui_handle != NULL) { - info = g_new0(PurpleNotifyInfo, 1); - info->type = PURPLE_NOTIFY_SEARCHRESULTS; - info->handle = gc; - info->ui_handle = ops->notify_searchresults(gc, title, primary, - secondary, results, user_data); - info->cb = cb; - info->cb_user_data = user_data; + PurpleNotifyInfo *info = g_new0(PurpleNotifyInfo, 1); + info->type = PURPLE_NOTIFY_SEARCHRESULTS; + info->handle = gc; + info->ui_handle = ui_handle; + info->cb = cb; + info->cb_user_data = user_data; - if (info->ui_handle != NULL) { handles = g_list_append(handles, info); return info->ui_handle; - - } else { - if (info->cb != NULL) - info->cb(info->cb_user_data); - - g_free(info); + } + } - return NULL; - } - - } else { - if (cb != NULL) - cb(user_data); - } + if (cb != NULL) + cb(user_data); return NULL; } @@ -449,37 +410,30 @@ ops = purple_notify_get_ui_ops(); if (ops != NULL && ops->notify_userinfo != NULL) { - PurpleNotifyInfo *info; - - info = g_new0(PurpleNotifyInfo, 1); - info->type = PURPLE_NOTIFY_USERINFO; - info->handle = gc; + void *ui_handle; purple_signal_emit(purple_notify_get_handle(), "displaying-userinfo", purple_connection_get_account(gc), who, user_info); - info->ui_handle = ops->notify_userinfo(gc, who, user_info); - info->cb = cb; - info->cb_user_data = user_data; + ui_handle = ops->notify_userinfo(gc, who, user_info); + + if (ui_handle != NULL) { - if (info->ui_handle != NULL) { + PurpleNotifyInfo *info = g_new0(PurpleNotifyInfo, 1); + info->type = PURPLE_NOTIFY_USERINFO; + info->handle = gc; + info->ui_handle = ui_handle; + info->cb = cb; + info->cb_user_data = user_data; + handles = g_list_append(handles, info); return info->ui_handle; - - } else { - if (info->cb != NULL) - info->cb(info->cb_user_data); - - g_free(info); + } + } - return NULL; - } - - } else { - if (cb != NULL) - cb(user_data); - } + if (cb != NULL) + cb(user_data); return NULL; } @@ -705,22 +659,19 @@ ops = purple_notify_get_ui_ops(); if (ops != NULL && ops->notify_uri != NULL) { - PurpleNotifyInfo *info; + + void *ui_handle = ops->notify_uri(uri); + + if (ui_handle != NULL) { - info = g_new0(PurpleNotifyInfo, 1); - info->type = PURPLE_NOTIFY_URI; - info->handle = handle; - info->ui_handle = ops->notify_uri(uri); + PurpleNotifyInfo *info = g_new0(PurpleNotifyInfo, 1); + info->type = PURPLE_NOTIFY_URI; + info->handle = handle; + info->ui_handle = ui_handle; - if (info->ui_handle != NULL) { handles = g_list_append(handles, info); return info->ui_handle; - - } else { - g_free(info); - - return NULL; } }