Mercurial > pidgin.yaz
diff finch/plugins/gnthistory.c @ 15823:32c366eeeb99
sed -ie 's/gaim/purple/g'
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Mon, 19 Mar 2007 07:01:17 +0000 |
parents | 0e3a8505ebbe |
children | 4999bbc52881 |
line wrap: on
line diff
--- a/finch/plugins/gnthistory.c Mon Mar 19 06:11:46 2007 +0000 +++ b/finch/plugins/gnthistory.c Mon Mar 19 07:01:17 2007 +0000 @@ -37,54 +37,54 @@ #define HISTORY_SIZE (4 * 1024) -static void historize(GaimConversation *c) +static void historize(PurpleConversation *c) { - GaimAccount *account = gaim_conversation_get_account(c); - const char *name = gaim_conversation_get_name(c); - GaimConversationType convtype; + PurpleAccount *account = purple_conversation_get_account(c); + const char *name = purple_conversation_get_name(c); + PurpleConversationType convtype; GList *logs = NULL; const char *alias = name; - GaimLogReadFlags flags; + PurpleLogReadFlags flags; char *history; char *header; - GaimMessageFlags mflag; + PurpleMessageFlags mflag; - convtype = gaim_conversation_get_type(c); - if (convtype == GAIM_CONV_TYPE_IM) + convtype = purple_conversation_get_type(c); + if (convtype == PURPLE_CONV_TYPE_IM) { GSList *buddies; GSList *cur; /* If we're not logging, don't show anything. * Otherwise, we might show a very old log. */ - if (!gaim_prefs_get_bool("/core/logging/log_ims")) + if (!purple_prefs_get_bool("/core/logging/log_ims")) return; /* Find buddies for this conversation. */ - buddies = gaim_find_buddies(account, name); + buddies = purple_find_buddies(account, name); /* If we found at least one buddy, save the first buddy's alias. */ if (buddies != NULL) - alias = gaim_buddy_get_contact_alias((GaimBuddy *)buddies->data); + alias = purple_buddy_get_contact_alias((PurpleBuddy *)buddies->data); for (cur = buddies; cur != NULL; cur = cur->next) { - GaimBlistNode *node = cur->data; + PurpleBlistNode *node = cur->data; if ((node != NULL) && ((node->prev != NULL) || (node->next != NULL))) { - GaimBlistNode *node2; + PurpleBlistNode *node2; - alias = gaim_buddy_get_contact_alias((GaimBuddy *)node); + alias = purple_buddy_get_contact_alias((PurpleBuddy *)node); /* We've found a buddy that matches this conversation. It's part of a - * GaimContact with more than one GaimBuddy. Loop through the GaimBuddies + * PurpleContact with more than one PurpleBuddy. Loop through the PurpleBuddies * in the contact and get all the logs. */ for (node2 = node->parent->child ; node2 != NULL ; node2 = node2->next) { logs = g_list_concat( - gaim_log_get_logs(GAIM_LOG_IM, - gaim_buddy_get_name((GaimBuddy *)node2), - gaim_buddy_get_account((GaimBuddy *)node2)), + purple_log_get_logs(PURPLE_LOG_IM, + purple_buddy_get_name((PurpleBuddy *)node2), + purple_buddy_get_account((PurpleBuddy *)node2)), logs); } break; @@ -93,71 +93,71 @@ g_slist_free(buddies); if (logs == NULL) - logs = gaim_log_get_logs(GAIM_LOG_IM, name, account); + logs = purple_log_get_logs(PURPLE_LOG_IM, name, account); else - logs = g_list_sort(logs, gaim_log_compare); + logs = g_list_sort(logs, purple_log_compare); } - else if (convtype == GAIM_CONV_TYPE_CHAT) + else if (convtype == PURPLE_CONV_TYPE_CHAT) { /* If we're not logging, don't show anything. * Otherwise, we might show a very old log. */ - if (!gaim_prefs_get_bool("/core/logging/log_chats")) + if (!purple_prefs_get_bool("/core/logging/log_chats")) return; - logs = gaim_log_get_logs(GAIM_LOG_CHAT, name, account); + logs = purple_log_get_logs(PURPLE_LOG_CHAT, name, account); } if (logs == NULL) return; - mflag = GAIM_MESSAGE_NO_LOG | GAIM_MESSAGE_SYSTEM | GAIM_MESSAGE_DELAYED; - history = gaim_log_read((GaimLog*)logs->data, &flags); + mflag = PURPLE_MESSAGE_NO_LOG | PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_DELAYED; + history = purple_log_read((PurpleLog*)logs->data, &flags); header = g_strdup_printf(_("<b>Conversation with %s on %s:</b><br>"), alias, - gaim_date_format_full(localtime(&((GaimLog *)logs->data)->time))); - gaim_conversation_write(c, "", header, mflag, time(NULL)); + purple_date_format_full(localtime(&((PurpleLog *)logs->data)->time))); + purple_conversation_write(c, "", header, mflag, time(NULL)); g_free(header); - if (flags & GAIM_LOG_READ_NO_NEWLINE) - gaim_str_strip_char(history, '\n'); - gaim_conversation_write(c, "", history, mflag, time(NULL)); + if (flags & PURPLE_LOG_READ_NO_NEWLINE) + purple_str_strip_char(history, '\n'); + purple_conversation_write(c, "", history, mflag, time(NULL)); g_free(history); - gaim_conversation_write(c, "", "<hr>", mflag, time(NULL)); + purple_conversation_write(c, "", "<hr>", mflag, time(NULL)); - g_list_foreach(logs, (GFunc)gaim_log_free, NULL); + g_list_foreach(logs, (GFunc)purple_log_free, NULL); g_list_free(logs); } static void -history_prefs_check(GaimPlugin *plugin) +history_prefs_check(PurplePlugin *plugin) { - if (!gaim_prefs_get_bool("/core/logging/log_ims") && - !gaim_prefs_get_bool("/core/logging/log_chats")) + if (!purple_prefs_get_bool("/core/logging/log_ims") && + !purple_prefs_get_bool("/core/logging/log_chats")) { - gaim_notify_warning(plugin, NULL, _("History Plugin Requires Logging"), + purple_notify_warning(plugin, NULL, _("History Plugin Requires Logging"), _("Logging can be enabled from Tools -> Preferences -> Logging.\n\n" "Enabling logs for instant messages and/or chats will activate " "history for the same conversation type(s).")); } } -static void history_prefs_cb(const char *name, GaimPrefType type, +static void history_prefs_cb(const char *name, PurplePrefType type, gconstpointer val, gpointer data) { - history_prefs_check((GaimPlugin *)data); + history_prefs_check((PurplePlugin *)data); } static gboolean -plugin_load(GaimPlugin *plugin) +plugin_load(PurplePlugin *plugin) { - gaim_signal_connect(gaim_conversations_get_handle(), + purple_signal_connect(purple_conversations_get_handle(), "conversation-created", - plugin, GAIM_CALLBACK(historize), NULL); + plugin, PURPLE_CALLBACK(historize), NULL); - gaim_prefs_connect_callback(plugin, "/core/logging/log_ims", + purple_prefs_connect_callback(plugin, "/core/logging/log_ims", history_prefs_cb, plugin); - gaim_prefs_connect_callback(plugin, "/core/logging/log_chats", + purple_prefs_connect_callback(plugin, "/core/logging/log_chats", history_prefs_cb, plugin); history_prefs_check(plugin); @@ -165,16 +165,16 @@ return TRUE; } -static GaimPluginInfo info = +static PurplePluginInfo info = { - GAIM_PLUGIN_MAGIC, - GAIM_MAJOR_VERSION, - GAIM_MINOR_VERSION, - GAIM_PLUGIN_STANDARD, + PURPLE_PLUGIN_MAGIC, + PURPLE_MAJOR_VERSION, + PURPLE_MINOR_VERSION, + PURPLE_PLUGIN_STANDARD, NULL, 0, NULL, - GAIM_PRIORITY_DEFAULT, + PURPLE_PRIORITY_DEFAULT, HISTORY_PLUGIN_ID, N_("GntHistory"), VERSION, @@ -183,7 +183,7 @@ "the last conversation into the current conversation."), "Sean Egan <seanegan@gmail.com>\n" "Sadrul H Chowdhury <sadrul@users.sourceforge.net>", - GAIM_WEBSITE, + PURPLE_WEBSITE, plugin_load, NULL, NULL, @@ -194,9 +194,9 @@ }; static void -init_plugin(GaimPlugin *plugin) +init_plugin(PurplePlugin *plugin) { } -GAIM_INIT_PLUGIN(gnthistory, init_plugin, info) +PURPLE_INIT_PLUGIN(gnthistory, init_plugin, info)