Mercurial > pidgin.yaz
diff pidgin/plugins/timestamp.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 | d75099d2567e |
| children | 07554cc5d090 |
line wrap: on
line diff
--- a/pidgin/plugins/timestamp.c Mon Mar 19 06:11:46 2007 +0000 +++ b/pidgin/plugins/timestamp.c Mon Mar 19 07:01:17 2007 +0000 @@ -1,5 +1,5 @@ /* - * Gaim - iChat-style timestamps + * Purple - iChat-style timestamps * * Copyright (C) 2002-2003, Sean Egan * Copyright (C) 2003, Chris J. Friesen <Darth_Sebulba04@yahoo.com> @@ -39,7 +39,7 @@ static int interval = 5 * 60; static void -timestamp_display(GaimConversation *conv, time_t then, time_t now) +timestamp_display(PurpleConversation *conv, time_t then, time_t now) { PidginConversation *gtk_conv = PIDGIN_CONVERSATION(conv); GtkWidget *imhtml = gtk_conv->imhtml; @@ -50,7 +50,7 @@ GdkRectangle rect; /* display timestamp */ - mdate = gaim_utf8_strftime(then == 0 ? "%H:%M" : "\n%H:%M", + mdate = purple_utf8_strftime(then == 0 ? "%H:%M" : "\n%H:%M", localtime(&now)); gtk_text_buffer_get_end_iter(buffer, &iter); gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, mdate, @@ -62,29 +62,29 @@ GTK_TEXT_VIEW(imhtml), &iter, &y, &height); if (((y + height) - (rect.y + rect.height)) > height && gtk_text_buffer_get_char_count(buffer)) { - gboolean smooth = gaim_prefs_get_bool( - "/gaim/gtk/conversations/use_smooth_scrolling"); + gboolean smooth = purple_prefs_get_bool( + "/purple/gtk/conversations/use_smooth_scrolling"); gtk_imhtml_scroll_to_end(GTK_IMHTML(imhtml), smooth); } } static gboolean -timestamp_displaying_conv_msg(GaimAccount *account, const char *who, - char **buffer, GaimConversation *conv, - GaimMessageFlags flags, void *data) +timestamp_displaying_conv_msg(PurpleAccount *account, const char *who, + char **buffer, PurpleConversation *conv, + PurpleMessageFlags flags, void *data) { time_t now = time(NULL) / interval * interval; time_t then; - if (!g_list_find(gaim_get_conversations(), conv)) + if (!g_list_find(purple_get_conversations(), conv)) return FALSE; - then = GPOINTER_TO_INT(gaim_conversation_get_data( + then = GPOINTER_TO_INT(purple_conversation_get_data( conv, "timestamp-last")); if (now - then >= interval) { timestamp_display(conv, then, now); - gaim_conversation_set_data( + purple_conversation_set_data( conv, "timestamp-last", GINT_TO_POINTER(now)); } @@ -92,12 +92,12 @@ } static void -timestamp_new_convo(GaimConversation *conv) +timestamp_new_convo(PurpleConversation *conv) { PidginConversation *gtk_conv = PIDGIN_CONVERSATION(conv); GtkTextBuffer *buffer; - if (!g_list_find(gaim_get_conversations(), conv)) + if (!g_list_find(purple_get_conversations(), conv)) return; buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtk_conv->imhtml)); @@ -105,7 +105,7 @@ "foreground", "#888888", "justification", GTK_JUSTIFY_CENTER, "weight", PANGO_WEIGHT_BOLD, NULL); - gaim_conversation_set_data(conv, "timestamp-last", GINT_TO_POINTER(0)); + purple_conversation_set_data(conv, "timestamp-last", GINT_TO_POINTER(0)); } static void @@ -114,15 +114,15 @@ int tm; tm = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spinner)); - gaim_debug(GAIM_DEBUG_MISC, "timestamp", + purple_debug(PURPLE_DEBUG_MISC, "timestamp", "setting interval to %d minutes\n", tm); interval = tm * 60; - gaim_prefs_set_int("/plugins/gtk/timestamp/interval", interval * 1000); + purple_prefs_set_int("/plugins/gtk/timestamp/interval", interval * 1000); } static GtkWidget * -get_config_frame(GaimPlugin *plugin) +get_config_frame(PurplePlugin *plugin) { GtkWidget *ret; GtkWidget *frame, *label; @@ -154,22 +154,22 @@ } static gboolean -plugin_load(GaimPlugin *plugin) +plugin_load(PurplePlugin *plugin) { - void *conv_handle = gaim_conversations_get_handle(); + void *conv_handle = purple_conversations_get_handle(); void *gtkconv_handle = pidgin_conversations_get_handle(); /* lower priority to display initial timestamp after logged messages */ - gaim_signal_connect_priority(conv_handle, "conversation-created", - plugin, GAIM_CALLBACK(timestamp_new_convo), NULL, - GAIM_SIGNAL_PRIORITY_DEFAULT + 1); + purple_signal_connect_priority(conv_handle, "conversation-created", + plugin, PURPLE_CALLBACK(timestamp_new_convo), NULL, + PURPLE_SIGNAL_PRIORITY_DEFAULT + 1); - gaim_signal_connect(gtkconv_handle, "displaying-chat-msg", - plugin, GAIM_CALLBACK(timestamp_displaying_conv_msg), NULL); - gaim_signal_connect(gtkconv_handle, "displaying-im-msg", - plugin, GAIM_CALLBACK(timestamp_displaying_conv_msg), NULL); + purple_signal_connect(gtkconv_handle, "displaying-chat-msg", + plugin, PURPLE_CALLBACK(timestamp_displaying_conv_msg), NULL); + purple_signal_connect(gtkconv_handle, "displaying-im-msg", + plugin, PURPLE_CALLBACK(timestamp_displaying_conv_msg), NULL); - interval = gaim_prefs_get_int("/plugins/gtk/timestamp/interval") / 1000; + interval = purple_prefs_get_int("/plugins/gtk/timestamp/interval") / 1000; return TRUE; } @@ -180,16 +180,16 @@ 0 /* page_num (Reserved) */ }; -static GaimPluginInfo info = +static PurplePluginInfo info = { - GAIM_PLUGIN_MAGIC, - GAIM_MAJOR_VERSION, - GAIM_MINOR_VERSION, - GAIM_PLUGIN_STANDARD, /**< type */ + PURPLE_PLUGIN_MAGIC, + PURPLE_MAJOR_VERSION, + PURPLE_MINOR_VERSION, + PURPLE_PLUGIN_STANDARD, /**< type */ PIDGIN_PLUGIN_TYPE, /**< ui_requirement */ 0, /**< flags */ NULL, /**< dependencies */ - GAIM_PRIORITY_DEFAULT, /**< priority */ + PURPLE_PRIORITY_DEFAULT, /**< priority */ TIMESTAMP_PLUGIN_ID, /**< id */ N_("Timestamp"), /**< name */ @@ -199,7 +199,7 @@ /** description */ N_("Display iChat-style timestamps every N minutes."), "Sean Egan <seanegan@gmail.com>", /**< author */ - GAIM_WEBSITE, /**< homepage */ + PURPLE_WEBSITE, /**< homepage */ plugin_load, /**< load */ NULL, /**< unload */ @@ -212,10 +212,10 @@ }; static void -init_plugin(GaimPlugin *plugin) +init_plugin(PurplePlugin *plugin) { - gaim_prefs_add_none("/plugins/gtk/timestamp"); - gaim_prefs_add_int("/plugins/gtk/timestamp/interval", interval * 1000); + purple_prefs_add_none("/plugins/gtk/timestamp"); + purple_prefs_add_int("/plugins/gtk/timestamp/interval", interval * 1000); } -GAIM_INIT_PLUGIN(interval, init_plugin, info) +PURPLE_INIT_PLUGIN(interval, init_plugin, info)
